This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes a question about 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 "a question about GC?" Watch "a question about GC?" New topic

a question about GC?

Peter Wei Cai

Joined: Oct 23, 2000
Posts: 2

Which of following are correct?
a, You can directly run the garbage collector whenever you want to
b, You can directly run the garbage collector whenever you want to, but you can not directly free the memory allocated by an object.
c, The garbage collector informs your object when it is about to be garbage collected.
Thank you for any suggestion!
Bin Zhao
Ranch Hand

Joined: Oct 04, 2000
Posts: 73
I think c) is the answer.
Since you can never directly run GC, a) and b) are wrong
Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
c is obviously right because of the mark and sweep algorithm that the gc uses.
I agree. Here's the link:
subject: a question about GC?
It's not a secret anymore!