Wednesday, October 5, 2011

When Does the Garbage Collector Run in JVM ?




  • The garbage collector is under the control of the JVM. 
  • The JVM decides when to run the garbage collector.
  • Using Java program you can ask the JVM to run the garbage collector
        but there are no guarantees, under any circumstances, that the JVM       
        will comply.


  • JVM will typically run the garbage collector when it senses that memory is running low. 
  • Experience indicates that whenyour Java program makes a request for garbage collection, the JVM will usually grant your request in short order, but there are no guarantees. Just when you think you can count on it, the JVM will decide to ignore your request.

No comments:

Post a Comment