• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Another GC question

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,all
Which statement is true?
A. Programs will not run out of memory.
B. Objects that will never again be used are eligible for garbage collection.
C. Objects that are referred to by other objects will never be garbage collected.
D. Objects that can be reached from a live thread will never be garbage collected.
E. Objects are garbage collected immediately after the system recognizes they are
eligible.
What is the answer? CD?
Special wanna more info about B,C and D?
Thanks
Roger
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Roger -

Double check, I think that your answer is incorrect. Why do you think your answer is correct?
-Bert
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
According to me the correct answer is D.
As for C, the objects can still be garbage collected if we have a refernce of that object.i.e. we have islands of isolation wherein object can have reference from other object but these references are just circular and they both refer to each other, not any other thread so both of these objects can be garbabe collected.
About B, we can still have object in memory even if we r not using it.. as long as we do have a reference to that object, that object will not be garbage collected regardless of we are using it or not..
Regards,
Harjinder
 
Bert Bates
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Harjinder --
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic