What happens when we set Xmx and Xms equal size

meso_2600 picture meso_2600 · Apr 18, 2013 · Viewed 9.2k times · Source

When we set the values of Xms and Xmx to be equal, what is the impact on the FullGC, or allocation for young/ tenured gen in HotSpot.

Does it make any difference in JRockit?

Answer

Fabian Lange picture Fabian Lange · Aug 20, 2013

Setting these two parameters to the same value is a best practice. It will prevent the JVM from resizing the heap. The main effect is that all the other parts of the heap, especially the generations, do not change due to heap resizing. This allows to much better understand and configure the heap. It also removes pauses caused by resizing the heap. The only secnario where one would not do it is a client java application, which competes with many other applications over available memory. In todays use cases, you often can assign a fixed chunk of memory to java (in all server apps for example)