Java使用的内存比分配的内存多 [英] Java using more memory than the allocated memory

查看:108
本文介绍了Java使用的内存比分配的内存多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下Java选项启动Apache Tomcat(Atlassian Confluence)实例:

An Apache Tomcat (Atlassian Confluence) instance is started using the following Java options:

JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true "

但是我在启动后看到了它可以快速占用我虚拟服务器上可用的大部分1GB内存。

However I see that after starting up it quickly eats through most of the 1GB of memory that is available on my virtual server.

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 6082 root      19   0 1105m 760m  16m S  0.7 74.2   5:20.51 java

整体消耗的内存(heap + PermGen)是否应该保持在使用-Xmx指定的内存之下?这导致的问题之一是我无法使用关闭脚本关闭服务器,因为它尝试生成具有256MB内存的JVM,因为它不可用而失败。

Shouldn't the overall consumed memory (heap + PermGen) stay under what is specified using -Xmx? One of the problems this is causing is that I cannot shutdown the server using the shutdown script since it tries to spawn a JVM with 256MB of memory which fails because of it not being available.

推荐答案

总的Tomcat内存消耗量应该小于 Xmx + XX:MaxPermSize (在你的情况下,768MB),但我记得在某个地方可以看到它。 Xmx 只是堆空间, PermGen 在堆外(种类)。

Total Tomcat memory consumption should be calculated at NO LESS THAN Xmx + XX:MaxPermSize (in your case, 768MB), but I do recall seeing somewhere that it can go over that. Xmx is only the heap space, and PermGen is outside the heap (kind of).

这篇关于Java使用的内存比分配的内存多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆