• 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: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q1. How can u force an object to be garbage collected?
A. Remove all refernces from the object
B. You can not force an object to be garbage collected.
there were 2 more option.
I thought A.
but correct ans is given B.
But I think if you remove all references then it will be elgible for garbage collection and will collected by garbage collection thread.
correct me if I am wrong.
 
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i think you gave the answer yourself!


But I think if you remove all references then it will be elgible for garbage collection and will collected by garbage collection thread


it will be elgible for gc.
you cant force it to be gc.
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ravish :
I believe there have neem several discussions on this topic before. Please do a search before posting questions. It will save you and everyone else a lot of time.
You can make an object eligible for garbage collection, but you can not force garbage collection to take place.
HTH
 
A wop bop a lu bop a womp bam boom! Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic