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


sean cee
Ranch Hand

Joined: Oct 24, 2000
Posts: 115
are following statements about garbage collection true?
a) GC informs your object when it is about to be garbage collected.
b) GC runs in low-memory situations.
Not sure about a)
I thought b) is false .. cos GC is vendor dependent.
Any idea?
Thanks in advance..

Sean <br />SCJP2, SCJP2p1.4, SCWCD
Vaneet Bhutani

Joined: Sep 13, 2000
Posts: 18
I think that a) is false, too. Logically, it does not seem to make cany sense to inform the object that is to be garbage collected that you are gonna' be gc'd.
Could the ranch-experts nod yes/no!
lakshmi nair
Ranch Hand

Joined: Oct 11, 2000
Posts: 63
a is true. And that is why finalize() is run before an object is garbage collected.
And i think b is false, since you cannot guarantee that gc will run, even at low memory situations.
I agree. Here's the link:
subject: GC
It's not a secret anymore!