• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Garbage Collector

 
Joe Harry
Ranch Hand
Posts: 10047
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

Consider the following code and please tell me why only 3 objects are garbage collected?



Anyone please help me with this. When run as
>java finalizers 5 500000....please interpret me the result? Thanks early for your answers.

Regards,
Jothi Shankar Kumar. S
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All objects need not necessarily be garbage collected. The output will be different in different environment settings. In my system 4 objects were garbage collected. There is no guarentee that all unnecessary objects will be GCed.
 
Joe Harry
Ranch Hand
Posts: 10047
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi above,

So what to do when I get such questions asking for how many objects will be garbage collected considering the above code. I too know that the gc is totally under the control of JVM. Please can anyone give me ideason what to concentrate and on what not to for the scjp 1.4, Garbage collectors topic.

Regards,
Jothi Shankar Kumar. S
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can select the option "Cannot be determined".
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic