问题描述
我的tomcat服务器表现很奇怪,它从系统分配了6GB的内存,但是超过4GB的标记为空闲".
My tomcat server is behaving strange, it has allocated 6GB of memory from system, but more than 4GB is marked as "free".
这是tomcat服务器状态的屏幕:
This is a screen from tomcat server status:
我了解JVM中的可用内存"的含义,但是我不明白为什么它不返回,因此在这种情况下至少要有3GB的内存返回系统.
I understand what "Free memory" in JVM means, but I do not understand why it is not returning lets say in this situation at least 3GB back to system.
Env:
- Java 8
- Tomcat 8
- Debian 8.3
- 计算机上的总内存:64 GB
推荐答案
由于尚未覆盖任何JVM选项,因此Tomcat使用默认的垃圾收集器,即JDK 8中的ParallelGC.
Since you haven't overridden any JVM options, Tomcat uses the default garbage collector which is ParallelGC in JDK 8.
ParallelGC不会取消提交堆内存.尝试-XX:+UseG1GC
选项. G1垃圾收集器能够将内存释放回操作系统.
ParallelGC does not uncommit heap memory. Try -XX:+UseG1GC
option. G1 garbage collectoris capable of releasing memory back to the OS.
请参见这篇文章有关更多信息.
这篇关于Tomcat服务器的JVM可用内存未返回操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!