String Constant Pool memory sector and garbage collection

Posted by WickeD on Stack Overflow See other posts from Stack Overflow or by WickeD
Published on 2012-06-08T16:13:13Z Indexed on 2012/06/08 16:40 UTC
Read the original article Hit count: 290

I read this question on the site How is the java memory pool divided? and i was wondering to which of these sectors does the "String Constant Pool" belongs?

And also does the String literals in the pool ever get GCed?

The intern() method returns the base link of the String literal from the pool.

If the pool does gets GCed then wouldn't it be counter-productive to the idea of the string pool? New String literals would again be created nullifying the GC.

(It is assuming that only a specific set of literals exist in the pool, they never go obsolete and sooner or later they will be needed again)

© Stack Overflow or respective owner

Related posts about java

Related posts about memory-management