| Author |
Doubt about garbage collection
|
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
my question is memory is reclaimed for which object here?? finalize will run for which object?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
|
The garbage collector will call the finalize() method of an object it's about to dispose of. The finalize() you supply here is in the class CheckGC; since no CheckGC objects are ever created, this finalize() will never be called. If the Date class had a finalize() method, then it could be called many times because of all the Date objects being created and discarded.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: Doubt about garbage collection
|
|
|