Originally posted by Dominic Mack:
The finalize() method is guaranteed to be called on any object to be GC�ed
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Originally posted by Dominic Mack:
does this mean that once an object is ready to be GC'ed, it's finalize() method is guaranteed to be called?
Originally posted by Prakash Yamuna:
From my understanding an object that is unreachable will be GC'ed eventually. While there ia no guarantee on the time period, there is a guarantee of such a service by the JVM unless it crashes.
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Originally posted by Dominic Mack:
Thank you all for your replies.... I appreciate it very much.
If I can sum it up, the question is either poorly worded or my assumptions are wrong. Because after reviewing what everyone wrote, it seems nothing is "guaranteed" in Java because of the possiblity of a JVM crash.
So the statement:
The finalize() method is guaranteed to be called on any object to be GC�ed
is false.
Even outside of a JVM crash, it still seems like the finalize() method is still not guaranteedto be called on an object to be GC'ed, (even though the spec says it does) as demonstrated by Bill Krieger's code.
Darryl Failla
Sun Certified Java 2 Programmer
Originally posted by darryl failla:
If an object is resurrected in the finalize()...
Don't get me started about those stupid light bulbs. |