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.
-
Execution of Garbage Collector. (4 messages)
- Posted by: Tarun Dewan
- Posted on: September 04 2003 02:41 EDT
Threaded Messages (4)
- "garbage collection" by supraja madhavi on September 04 2003 07:50 EDT
- "garbage collection" by Ian Mitchell on September 04 2003 14:05 EDT
- Java... by Sean Sullivan on September 04 2003 14:24 EDT
- Re: Execution of Garbage Collector. by Shekhar Gulati on November 15 2008 20:52 EST
-
"garbage collection"[ Go to top ]
- Posted by: supraja madhavi
- Posted on: September 04 2003 07:50 EDT
- in response to Tarun Dewan
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. -
"garbage collection"[ Go to top ]
- Posted by: Ian Mitchell
- Posted on: September 04 2003 14:05 EDT
- in response to supraja madhavi
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. -
Java...[ Go to top ]
- Posted by: Sean Sullivan
- Posted on: September 04 2003 14:24 EDT
- in response to Tarun Dewan
-
Re: Execution of Garbage Collector.[ Go to top ]
- Posted by: Shekhar Gulati
- Posted on: November 15 2008 20:52 EST
- in response to Tarun Dewan
You can understand about garbage collection at http://www.java4all.info/articles/corejava/garbage-collection-java.html