• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Garbage Collection

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

suppose a object is to be garbage collected and so its finalize method is running in which "m not passing any references of that object anywhere else"

in that is it guaranteed that the object will be garbage collected after the finalize method is run.

or is there any possibility that even after running finalize method for an object that garbage collector might not collect it.

important :- am not passing references to that object from finalize method.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sharan vasandani:
hi,

suppose a object is to be garbage collected and so its finalize method is running in which "m not passing any references of that object anywhere else"

in that is it guaranteed that the object will be garbage collected after the finalize method is run.

or is there any possibility that even after running finalize method for an object that garbage collector might not collect it.

important :- am not passing references to that object from finalize method.




the jvm takes care of the garbage collection. it implements garbage collection by calling the finalize methods on the respective Objects.
so if a finalize method is called upon an object, the space occupied by the object is freed and returned to the heap... it is gauranted...
however it is up to the jvm to decide when to garbage collect or when not to or even say to call finalize method on which object...if it finds any references it stops the finalize method of that objectand proceeds further without interrupting the garbage collection procedure...ok....


got the answer.. if you still have any doubts .... check this linkout..

java world
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic