This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I am confused with GC terms. 1.Garbage Collection can be forced using System.gc() or runtime.gc() . True or False ? 2. Is there any difference in the terms a)forcing Garbage Collection b)invoking Garbage Collection explicitly. 3. In no situation it is guaranteed that Garbage Collection will run. Am I right ? Thanks in advance.
Originally posted by Ambapali Pal: 1.Garbage Collection can be forced using System.gc() or runtime.gc() . True or False ?
2. Is there any difference in the terms a)forcing Garbage Collection b)invoking Garbage Collection explicitly.
None of them is gurantteed.
3. In no situation it is guaranteed that Garbage Collection will run. Am I right ?
You are right.
Joined: Dec 17, 2002
Thanks Don. Regarding 1st question there is a line from Khalid/Rasmussen book. "Java provides a facility to invoke the garbage collection explicitly." Ofcourse they are System.gc() and Runtime.gc(). If answer to the 2nd question is that there is no difference between forcing GC and invoking GC explicitly , then how come the above sentense is true??? Any good documents on GC?
Ambapali - Please read the post dated 12/18 entitled 'one more time G.C. Q & A'. Then write me an email if you have more questions, I have a proposition for you... -Bert p.s. You can only make a request to the GC, you can never force it to run, and you can never guarantee that it will run. :roll:
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Joined: Dec 17, 2002
Thanks Bert. I read 12/18 th post about the GC. That is a very good way of checking the objects which are eligible for GC. I get most of the answer right if I use this method. Most of the problem I face on GC is the TRUE/FALSE questions about the behavior that is guaranteed by the garbage collection system. I just dodnot get it right Right now I donot have any doubt. I will surely have it when I go through the more mock exams. And I will bug you again. Ambapali