Execution of Garbage Collector.

Discussions

General J2EE: Execution of Garbage Collector.

  1. Execution of Garbage Collector. (4 messages)

    HI All,

    Do we need to set the object (except connection etc.) variable as null to release the same from memory and to be marked for Garbage Collector or it is done automatically as soon as object is out of current scope execution.

    Thanks & regards,

    Tarun Dewan.

    Threaded Messages (4)

  2. "garbage collection"[ Go to top ]

    keeping null for garbage collector is good practice.But garbage collector will take care too destroy the variables once refrences to those variables are destroyed.
  3. "garbage collection"[ Go to top ]

    Setting to null will only mark an object for garbage collection if there are no other references to it.

    So all references to the the object must have either fallen out of scope or been assigned to something else (such as null) for garbage collection to pick it up.
  4. Java...[ Go to top ]

    http://java.sun.com/docs/books/tutorial/java/data/objects.html

     http://java.sun.com/docs/books/tutorial/java/data/garbagecollection.html
  5. Re: Execution of Garbage Collector.[ Go to top ]

    You can understand about garbage collection at http://www.java4all.info/articles/corejava/garbage-collection-java.html