• 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

Garbage Collection?

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

What does this statement imply?

An array reference is eligible for garbage collection when it is no longer reachable.


Shouldn't it be an object of type array (int or String for example) is eligible for gc when it no longer has any reachable references?

Please anyone help me on this.

Regards,
Jothi Shankar Kumar. S
[ October 18, 2006: Message edited by: Jothi Shankar Kumar Sankararaj ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you see something like this please give the reference to it. As it happens, I also saw this today in Marcus Green's Question of The Day quiz.

I too do not agree with it. You are correct, in my opinion, it should be array object or just array. Perhaps, if you have time, you can give Marcus some feedback on that question (Question Number 180).
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way,
why is this option wrong in todays question?
"Setting an object reference to null will guarantee the object is eligable for garbage collection."

So if

than obj is eligible for garbage collection..isnt it??

Thanks
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Barry,

Thanks for the reply.

I have given the feedback for that question.

Regards,
Jothi Shankar Kumar. S
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jothi,

An array reference is eligible for garbage collection when it is no longer reachable.


the statement is from todays question of the day (Marcus Green's examulator).


you asked:

What does this statement imply?
Shouldn't it be an object of type array (int or String for example) is eligible for gc when it no longer has any reachable references?



I think it is ok. "When it is no longer reachable" implies, that it has no reachable references. Or that no live thread can access it.

And all arrays (even those of primitives) are objects.


prints: true


Yours,
Bu.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Burkhard,

Why is the other option wrong? and by the way what it means by saying an array refernce has no reachable reference? Rather it should say an array object has no reachable reference. So 4th option should be correct in todays question.

Regards,
Jothi Shankar Kumar. S
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
prashanth kumar posted October 18, 2006 05:28 AM

By the way,
why is this option wrong in todays question?
"Setting an object reference to null will guarantee the object is eligable for garbage collection."



Hi Prashanth,


in your case it is eligible. But strictly speaking it should be said that setting ALL the objects references to null...

eg


Know what I mean?


Yours,
Bu.
 
prashanth kumar
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes...I got your point.
Thanks for clarification

Regards
Prashanth
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jothi Shankar Kumar Sankararaj posted October 18, 2006 05:35 AM

Hi Burkhard,

Why is the other option wrong? and by the way what it means by saying an array refernce has no reachable reference? Rather it should say an array object has no reachable reference. So 4th option should be correct in todays question.




Hi Jothi,

you're right, I'm wrong.

The word "reference" should be either deleted or replaced by "object".
Seems, I just overread it.

Yours,
Bu.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Burkhard,

Thanks for the reply. I just got convinced. I started to think stupid like references or references and so on and was trying to imagine how a reference would have a reachable reference...Thanks ranchers for all the help. We are yet to hear from Marcus regarding this. Hope there will a big one on this soon.

Regards,
Jothi Shankar Kumar. S
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jothi,

you're welcome.

If I spot a question like these, I always do a little trick. I close my eyes and say to myself (three times): "Objects can be eligible, variables never."

It works.



Yours,
Bu.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic