File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General 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 » Java » Java in General
Bookmark "Garbage collection" Watch "Garbage collection" New topic
Author

Garbage collection

Praveen Chaudhary
Greenhorn

Joined: Jul 09, 2009
Posts: 11
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


Thanks & Regards
Praveen Chaudhary
Analyst-Java.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39834
    
  28
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

Joined: Jul 24, 2007
Posts: 3
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

    Srikanth
    Maneesh Godbole
    Saloon Keeper

    Joined: Jul 26, 2007
    Posts: 10523
        
        9

    srikanth V T wrote:


    Please check your private messages for an important administrative matter.


    [How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
    Praveen Chaudhary
    Greenhorn

    Joined: Jul 09, 2009
    Posts: 11
    Hi javaranchers
    I am expecting a knowledgeable and in depth answer on this topic please reply .I know you know it.
    Rob Spoor
    Sheriff

    Joined: Oct 27, 2005
    Posts: 19761
        
      20

    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


    SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
    How To Ask Questions How To Answer Questions
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Garbage collection