• 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: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following statements related to Garbage Collection are correct. Select the two correct answers.
(a)It is possible for a program to free memory at a given time.
(b)Garbage Collection feature of Java ensures that the program never runs out of memory.
(c)It is possible for a program to make an object available for Garbage Collection.
(d)The finalize method of an object is invoked before garbage collection is performed on the object.
Ans given are (c) and (d).
Would it be correct to say (c) is true?
I've been going back and forth between yes and no. Well it is possible by making the object ref to null, we are suggesting the object can be GCd. But would you call that "it is possible for a program to make an object avail for GC".

Monisha.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My understanding is you can enable an object for GC by making it as null.
It is upto the JRE to decide when to make an GC, for the objects not referred anymore.
correct me if I am wrong
Regards
PREM
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic