• 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

about Garbage collection

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The garbage collector can be invoked explicitly using a Runtime object.
I think the statement is not correct.Because you can only suggust but not call directly garbage collection.
But the answer of MindQ's exam is true.
Who can explain it to me?
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello rainbow,
what u have said is true, you simply cannot call garbage collection. It is the work of JVM. JVM follows some algorthim
based on which it performs garbage collection by some of its
own methods.
U can only request for garbage collection by some of runtime
methods like gc(), in finally etc.
For more details about how it occurs refer to the book
INSIDE JAVA VIRTUAL MACHINE.
I think u got the concept.
regards
- mohan
 
rainbow
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mohan,Thanks for your immediate help.
I have known someone can invoke garbage collection through System.gc(); method.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rainbow,
I think the answer is right and it has got to do with the English language rather than Java! You have the concept about gc right but when he says that gc can be invoked explicitly, I think, what he means is that there is a method available to call gc (System.gc()). However, whether JVM obeys the invocation or not is entirely it's own decision. That's the reason why there is no gaurantee on gc.
But the answer to the question is true since there is method available to explicitly invoke gc.
Hope this hepls.
Srikrish.
 
rainbow
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
srikrish
I'm clear with the question now.Thanks a lot.
Further more,I agree with your viewpoint.It's with English than java.I must be careful in the real exam.
rainbow

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic