美文网首页
garbage collection in Java

garbage collection in Java

作者: Zihowe | 来源:发表于2017-09-27 13:04 被阅读13次

    Garbage Collector is to free heap memory by destroying unreachable objects.

    Unreachable objects :

    An object is said to be unreachable if it doesn’t contain any reference to it. Also note that objects which are part of island of isolation are also unreachable.

    Island of Isolation:

    Object 1 references Object 2 and Object 2 references Object 1. Neither Object 1 nor Object 2 is referenced by any other object. That’s an island of isolation.

    Basically, an island of isolation is a group of objects that reference each other but they are not referenced by any active object in the application. Strictly speaking, even a single unreferenced object is an island of isolation too.

    // requesting JVM for running Garbage Collector
    System.gc();
    

    References:

    http://www.geeksforgeeks.org/garbage-collection-java/

    相关文章

      网友评论

          本文标题:garbage collection in Java

          本文链接:https://www.haomeiwen.com/subject/gncuextx.html