Sunday 18 September 2016

String Constant Pool

12.7 String Constant Pool memory

What is String Constant Pool memory : (SCP)
  • Its a specially designed memory to store String objects.
  • If we are using literal to create a String object then that object will be directly created in SCP memory and points to the reference.
  • While creating String object with literal if JVM finds any duplicate objects then JVM will reuse the existing object which is available in SCP memory instead of creating new object.
  • Memory will be used effectively for String objects because of String Constant Pool memory.
  • In SCP one object can pointing to multiple references if we are trying to create duplicate objects by literal.
  • So, duplicate objects will not exist in SCP memory.
Thanks for your time.