What happens when we set Xmx and Xms equal size

2020-03-12 07:42发布

问题:

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?

回答1:

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)