Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

GC questions

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ambapali Pal:
1.Garbage Collection can be forced using System.gc() or runtime.gc() . True or False ?


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.
 
Ambapali Pal
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author
Posts: 9031
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
Ambapali Pal
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic