This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage collection" Watch "Garbage collection" New topic

Garbage collection

Whiz Kid

Joined: Jul 02, 2002
Posts: 6
I am not able to follow the Concept of garbaghe collection and How to enforce it in a program.
Can anyone help me with this and any resources or links regardiong this will be of great help.
thaanks So much

gowri Venkatesh
Binu K Idicula
Ranch Hand

Joined: Jul 11, 2002
Posts: 99
You cannot enforce garbage collection. But you can request the system to do that by calling System.gc().
Garbage colector is a low priority thread running asynchronously to your program exacution threads.
It detects unreachable objects, mark them ,invoke it's finalize (if overridden ), and frees memory all in the background with no specific time bound.
You cannot specify the exact time of garbage collection.
Valentin Crettaz
Gold Digger

Joined: Aug 26, 2001
Posts: 7610
Good article on garbage collection:
Reference Objects and Garbage Collection

[Blog] [Blogroll] [My Reviews] My Linked In
It is sorta covered in the JavaRanch Style Guide.
subject: Garbage collection