What the difference between
-Xms4096m
-Xmx2048M
-XX:MaxPermSize=712M
I am getting confused of this two -Xmx2048M
and -XX:MaxPermSize=712M
and will happen if I use -Xmx2048M
or -Xmx2048m
Xms is minimum heap size which is allocated at initialization of JVM in java. Xmx is the maximum heap size that JVM can use. It will set the minimum heap size of JVM to 512 megabytes.
Oracle recommends setting the minimum heap size ( -Xms) equal to the maximum heap size ( -Xmx) to minimize garbage collections.
The perm size should be set to 1024 Megabytes. The maximum perm size should be set to 1024 Megabytes. Oracle recommends that -Xmn and -Xmx be set to the same value. This eliminates potentially costly heap reallocations, and can reduce the amount of heap fragmentation that can occur.
Run the tomcat6w application Click the Java tab. Edit the values in the Java Options box. The following settings allocate 2 GB memory to the start Java heap, 6 GB for the maximum heap size, 128 MB for the permgen space and 256 MB for the maximum permgen size.
Java objects reside in an area called the heap, while metadata such as class objects and method objects reside in the permanent generation or Perm Gen area. The permanent generation is not part of the heap.
The heap is created when the JVM starts up and may increase or decrease in size while the application runs. When the heap becomes full, garbage is collected. During the garbage collection objects that are no longer used are cleared, thus making space for new objects.
-Xmssize Specifies the initial heap size.
-Xmxsize Specifies the maximum heap size.
-XX:MaxPermSize=size Sets the maximum permanent generation space size. This option was deprecated in JDK 8, and superseded by the -XX:MaxMetaspaceSize option.
Sizes are expressed in bytes. Append the letter k
or K
to indicate kilobytes, m
or M
to indicate megabytes, g
or G
to indicate gigabytes.
How is the java memory pool divided?
What is perm space?
Java (JVM) Memory Model – Memory Management in Java
Java 7 SE Command Line Options
Java 7 HotSpot VM Options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With