Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding java heap

Tags:

java

In order to determine java heap size I used the following command:

java -XX:+PrintFlagsFinal -version -h | grep HeapSize 
    uintx ErgoHeapSizeLimit                         = 0               {product}           
    uintx HeapSizePerGCThread                       = 87241520        {product}           
    uintx InitialHeapSize                          := 1586475520      {product}           
    uintx LargePageHeapSizeThreshold                = 134217728       {product}           
    uintx MaxHeapSize                              := 25383927808     {product}           
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

However, I am unable to understand as to what is meant by ErgoHeapSizeLimit, HeapSizePerGCThread, InitialHeapSize, LargePageHeapSizeThreshold, MaxHeapSize, etc. Can someone please briefly explain these terms. Actually I am a complete novice at java

Actually I need to determine the heap size which my machine can allocate to a process? Because one of my application demands the following parameters: -server, -Xmx16G or better, etc. to be set.

like image 242
user3809749 Avatar asked Oct 29 '14 13:10

user3809749


People also ask

What is the Java heap?

The Java heap is the area of memory used to store objects instantiated by applications running on the JVM. When the JVM is started, heap memory is created and any objects in the heap can be shared between threads as long as the application is running.

What is heap in Java with example?

Heap space is used for the dynamic memory allocation of Java objects and JRE classes at runtime. New objects are always created in heap space, and the references to these objects are stored in stack memory. These objects have global access and we can access them from anywhere in the application.

What is JVM heap memory?

The Java™ virtual machine (JVM) heap is an independent memory allocation that can reduce the capacity of the main memory heap. Every integration server creates its own JVM. The integration server uses the JVM to execute the internal administration threads that require Java. This usage is typically minimal.

What is a good Java heap size?

It is recommended to increase the Java heap space only up to one-half of the total RAM available on the server. Increasing the Java heap space beyond that value can cause performance problems. For example, if your server has 16 GB of RAM available, then the maximum heap space you should use is 8 GB.


1 Answers

Take a look here (they were extracted from OpenJDK):

http://jvm-options.tech.xebia.fr/

ErgoHeapSizeLimit: Maximum ergonomically set heap size (in bytes); zero means use MaxRAM / MaxRAMFraction

HeapSizePerGCThread: Size of heap (bytes) per GC thread used in calculating the number of GC threads

InitialHeapSize: Initial heap size (in bytes); zero means OldSize + NewSize

LargePageHeapSizeThreshold: Use large pages if max heap is at least this big

MaxHeapSize: Maximum heap size (in bytes)

like image 178
Pier-Alexandre Bouchard Avatar answered Sep 23 '22 00:09

Pier-Alexandre Bouchard