File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "GC" Watch "GC" New topic


sanjana narayanan
Ranch Hand

Joined: Nov 25, 2003
Posts: 142
Static objects are not garbage collected at all. They are considered to be live objects. Is this true.
Vad Fogel
Ranch Hand

Joined: Aug 25, 2003
Posts: 504
Hi, the answer is "False". A static reference is like any other reference - if it goes out of scope (i.e. no live thread can access it), the object referenced by it on the heap becomes available to GC. However, the system classes are never GC-ed. You may find the following link interesting:
No Silver Bullet - Garbage Collection for Java in Embedded Systems
Read the section named "Garbage Collection and Java".
I agree. Here's the link:
subject: GC
It's not a secret anymore!