aspose file tools
The moose likes Beginning Java and the fly likes Doubt about garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Doubt about garbage collection" Watch "Doubt about garbage collection" New topic
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
    
  13

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]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Doubt about garbage collection
 
Similar Threads
Garbage Collector program does not run
y aint here class <classname>=new <classname> used and instead only class <classname> used
Garbage collection example code from K&B
GC doubt
finalize question