my dog learned polymorphism
The moose likes Beginning Java and the fly likes garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "garbage collection" Watch "garbage collection" New topic

garbage collection

Arun Prasath
Ranch Hand

Joined: Jul 18, 2006
Posts: 60
will the string objects in the string constant pool be garbage collected?
Pradeep Kadambar
Ranch Hand

Joined: Oct 18, 2004
Posts: 148
No string literals are not garbage collected. Here is a very good explanation of the same.

web Garbage collection for String literals
Dana Bothner-By
Ranch Hand

Joined: Jul 28, 2006
Posts: 37
I thought that String literals could be garbage collected under ceratin conditions, like if the ClassLoader that causes them to be loaded into memory was itself garbage collected. Am I wrong?
I agree. Here's the link:
subject: garbage collection
It's not a secret anymore!