Prepare for your Next Interview
This is a discussion on when is an object ready to be garbage collected within the Java forums, part of the Software Development category; when is an object ready to be garbage collected by the compiler.is it the same way all the time...
|
|||
|
Re: when is an object ready to be garbage collected
Garbage collector is usefull to overcome memory crashes.so whenever it thinks any object is not usefull then it will be removed from the memory so it is collected by garbage collector
|
|
|||
|
Any Object that is not accessble by any LIVE thread(i.e active thread) then the garbage collector calls the finaliz() method on that object to release the acquired resourec before garbage collecting the Object.Once resorces released then the object is garbage collected .Pls feel free to ask for further expalnation.
Last edited by srini235 : 05-16-2008 at 03:07 AM. |
|
|||
|
Re: when is an object ready to be garbage collected
There are different implementation for garbage collection, one popular method is mark-and-sweep algorithm, where jvm puts objects in a graph, and traverse the graph based on if live thread exists from one object to other object. If there is no live thread, then jvm "mark" the object, and then "sweep" it off graph. Hence, the name is "mark-and-sweep".if there are other threads referring to the same object, then it won't be allocated. There are also ome advanced garbage collection implementation. You can read it in advanced java book senior computer science engineering student donald bren of information and computer science
university of california, irvine |
| The Following User Says Thank You to javaFreak85 For This Useful Post: | ||
|
|||
|
Re: when is an object ready to be garbage collected
everything is ok with garbage collector but a little doubt is there
can we see the object functionality after removing from memeoiry |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WinRunner not identified object , what 2 do other than virtual object wizard method. | jayant_gajbhiye | WinRunner | 6 | 10-16-2007 07:23 AM |
| How To know the Generation of Garbage Collector | satyaPATI | C# | 0 | 09-25-2007 05:12 AM |
| garbage collector | rohit dwivedi9450 | C and C++ | 3 | 03-21-2007 01:15 AM |
| Running garbage values before compling | JobHelper | Java | 2 | 02-21-2007 01:24 PM |
| Is PHP ready for Web 2.0? | Shivanna | HTML & CSS | 1 | 06-08-2006 09:14 PM |