Friday, March 7

JVM Heap Size and Garbage Collection



Garbage collection is the JVM’s process of freeing up unused Java objects in the Java heap.

The Java heap is where the objects of a Java program live. It is a repository for live objects, dead objects  and free memory. 

When an object can no longer be reached from any pointer in the running program, it is considered “garbage” and ready for collection.

The JVM heap size determines how often and how long the JVM spends collecting garbage. An acceptable rate for garbage collection is application-specific and should be adjusted after analyzing the actual time and frequency of garbage collections. If you set a large heap size, full garbage collection is slower, but it occurs less frequently. If you set your heap size in accordance with your memory needs, full garbage collection is faster, but occurs more frequently.

You might see the following Java error if you are running out of heap space:

java.lang.OutOfMemoryError <>
java.lang.OutOfMemoryError <>
Exception in thread "main"

To modify heap space values, see Specifying Heap Size Values.

To configure WebLogic Server to detect automatically when you are running out of heap space and to address low memory conditions in the server, see Automatically Logging Low Memory Conditions.

http://docs.oracle.com/cd/E13222_01/wls/docs81/perform/JVMTuning.html#1109778 
http://docs.oracle.com/cd/E13222_01/wls/docs81/perform/JVMTuning.html#1131009

2 comments:

  1. Quantum Binary Signals

    Get professional trading signals delivered to your mobile phone every day.

    Start following our trades today and make up to 270% per day.

    ReplyDelete
  2. BlueHost is the best website hosting company with plans for any hosting needs.

    ReplyDelete