This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
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".
Have you checked out Aspose?
subject: GC
It's not a secret anymore!