Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage collection" Watch "Garbage collection" New topic
Author

Garbage collection

R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5370
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.


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
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.
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage collection
 
Similar Threads
garbage collector
from Marcus Green mock
Q:65 on Barry Boone Exam
Runtime.gc() and System.gc()
garbage collection