about Java Garbage Collector

Java Garbage Collector -
      Garbage Collector in Java working for release the memory form waste (unreachable) object.
Garbage Collector works with heap memory.
              Any Object is created in Java it goes to the heap memory. When this object is being waste or unreachable then Garbage Collector release memory from its.

Understand about  waste or unreachable object -
   
    String s  = new String(“Albert”);

    String s1 = new String (“Another”);

    s1=s;

           in this case new String (“Another”); has been waste object.
Then  Garbage collector will release the memory form this object.

     Garbage Collector called by JVM directly. You can not force for release the memory.
You can request to Garbage Collector through System.gc() method.
    For tracing the event of Garbage Collection use this command
    -verbose:gc

Comments

Recent Post

Recent Posts Widget

Popular posts from this blog

Capture image from webcam java code, examples

Use of req.query, req.params and req.body in NODE JS

How to capture finger prints in java