• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage collection

 
Praveen Chaudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
How Jvm/compiler exactly locate that particular object is garbage collected when there is no reference available to that particular object.
Thanks
Praveen
 
Campbell Ritchie
Sheriff
Pie
Posts: 49796
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice book chapter, but may be as old as 1996. More recent article about performance of grabage collection. IBM article about garbage collection and null values. Joel Spolsky article explaining that the notion that garbage collection is an unnecessary overhead is false.
 
Srikanth Visamangalam Thattai
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The garbage collector cannot ensure that there will always be enough memory.
The garbage collection (GC) algorithm varies from one JVM to another.
There are different algorithms being used, like reference counting or the mark and sweep algorithm.

Please google up for more insight to those algorithms.


To request garbage collection, you can call either of the following methods:

  • System.gc()
  • Runtime.getRuntime().gc()



  • Regards,
    Srikanth
     
    Maneesh Godbole
    Saloon Keeper
    Posts: 11096
    13
    Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    srikanth V T wrote:


    Please check your private messages for an important administrative matter.
     
    Praveen Chaudhary
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi javaranchers
    I am expecting a knowledgeable and in depth answer on this topic please reply .I know you know it.
     
    Rob Spoor
    Sheriff
    Pie
    Posts: 20610
    63
    Chrome Eclipse IDE Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    It all depends on the garbage collector used. In Java the garbage collector has evolved quite a bit, and you can tune it. Check out the following sites:
    http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)
    http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
    http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html
    http://www.infoq.com/news/2008/05/g1
    http://blogs.sun.com/theplanetarium/entry/java_vm_trying_a_new
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic