Java heap Xms and linux free memory different

后端 未结 1 1557
-上瘾入骨i
-上瘾入骨i 2020-11-30 13:28

I have a java program running in centos Box. My -Xmx and -Xms set to 4000 Mb.

The program works fine.

But when i do free -m ,

相关标签:
1条回答
  • 2020-11-30 14:09

    Even when -Xmx and -Xms set to the same value, the space reserved for Java Heap is not immediately allocated in RAM.

    Operating System typically allocates physical memory lazily, only on the first access to a virtual page. So, while unused part of Java Heap is not touched, it won't really consume memory.

    You may use -XX:+AlwaysPreTouch option to forcibly touch all heap pages on JVM start.

    0 讨论(0)
提交回复
热议问题