• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GC , thread

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
-Can you please elaborate as when an object is eligible for garbage collectionc , i find it bit hard(with eg if possible).Any good link for the same?
-please send me good link related with threads and exception
thanks,
rajiv
[ August 26, 2003: Message edited by: Rajiv Goyal ]
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.jchq.net/certkey/0301certkey.htm
 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
object is eligible for gc when all it's references are set to null.
for e.g.

String str = new String("hi");//1
String str1= str;//2
str=null;//3
:
://some processing with str1
:
:
str1=null;//4

Here we have created a new object str which contains a string "hi"
now we r assigning that to str1. so now there r 2 references to string "hi".
So unless and until u are not making both str and str1 to null that object is not eligible for garbage collection.
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
object is eligible for gc when all it's references are set to null.
hmm.. not necessarily. Objects are eligible for garbage collector when there's no live thread that can reach that object.
reply
    Bookmark Topic Watch Topic
  • New Topic