Skip to content

garbage collection

Keyhan Hadjari edited this page Sep 6, 2016 · 1 revision
  • It is possible to make an object available for Garbage Collection
  • finalize() method of an object is invoked before garbage collection is performed on the object. If garbage collection fails the first time, then this method will not be called the second time.
  • System.gc() is not guaranteed to run garbage collection. It suggests that it might be good to start garbage collection.

Eligible objects for GC

  • If an object loses all its references then it is eligible for garbage collection.
  • All references to an object are out of scope.

Clone this wiki locally