Geeks Talk

Prepare for your Next Interview




when is an object ready to be garbage collected

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...


Go Back   Geeks Talk > Software Development > Java

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-05-2008
Junior Member
 
Join Date: Mar 2008
Location: chennai
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
raghavrules is on a distinguished road
when is an object ready to be garbage collected

when is an object ready to be garbage collected by the compiler.is it the same way all the time
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-05-2008
Junior Member
 
Join Date: Dec 2007
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
rajiram2007 is on a distinguished road
Re: when is an object ready to be garbage collected

Which the object is no longer needed in a particular application,that time tat object will be garage collected
Reply With Quote
  #3 (permalink)  
Old 03-15-2008
Junior Member
 
Join Date: Mar 2008
Location: Hyderabad
Posts: 8
Thanks: 1
Thanked 2 Times in 2 Posts
Mahesh Babu is on a distinguished road
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
Reply With Quote
  #4 (permalink)  
Old 05-16-2008
Junior Member
 
Join Date: May 2008
Location: hyderabad
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
srini235 is on a distinguished road
Thumbs up Re: when is an object ready to be garbage collected

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.
Reply With Quote
  #5 (permalink)  
Old 05-22-2008
Junior Member
 
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
rohitmania is on a distinguished road
Re: when is an object ready to be garbage collected

@srini235
But what if other threads are referring to that object somehow?
Reply With Quote
  #6 (permalink)  
Old 05-24-2008
Junior Member
 
Join Date: May 2008
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
javaFreak85 is on a distinguished road
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
Reply With Quote
The Following User Says Thank You to javaFreak85 For This Useful Post:
  #7 (permalink)  
Old 05-27-2008
Junior Member
 
Join Date: May 2008
Location: banglore
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
pradeep_babu is on a distinguished road
Re: when is an object ready to be garbage collected

Which the object is no longer used
Reply With Quote
  #8 (permalink)  
Old 05-28-2008
Junior Member
 
Join Date: May 2008
Location: mumbai
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
poo_roh is on a distinguished road
Re: when is an object ready to be garbage collected

when resoures linked with that object are not required for later
Reply With Quote
  #9 (permalink)  
Old 05-30-2008
Junior Member
 
Join Date: May 2008
Location: india
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
kameshboggala is on a distinguished road
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
Reply With Quote
  #10 (permalink)  
Old 06-02-2008
Junior Member
 
Join Date: Jun 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
encapsulation is on a distinguished road
Re: when is an object ready to be garbage collected

when there is no refrence pointing to that object& the object remains unreachable

Last edited by encapsulation : 06-02-2008 at 11:21 AM.
Reply With Quote
Reply

  Geeks Talk > Software Development > Java


Thread Tools
Display Modes


Similar Threads

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


All times are GMT -4. The time now is 09:40 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved