我们有一个运行在Solaris 10上的
java进程,为约200-300个并发用户提供服务.管理员已经报告过程中使用的内存随着时间的推移而显着增加.在几天内达到2GB,从不停止增长.
我们已经倾倒堆并使用Eclipse内存分析器进行分析,但无法看到任何普通的内存.堆大小非常小.
在添加内存状态记录之后,对我们的应用程序,我们发现由管理员使用的“top”实用程序报告的内存使用量与MemoryMXBean和Runtime库报告的使用情况之间存在差异.
这是两者的输出.
Memory usage information
From the Runtime library
Free memory: 381MB
Allocated memory: 74MB
Max memory: 456MB
Total free memory: 381MB
From the MemoryMXBean library.
Heap Committed: 136MB
Heap Init: 64MB
Heap Used: 74MB
Heap Max: 456MB
Non Heap Committed: 73MB
Non Heap Init: 4MB
Non Heap Used: 72MB
Current idle threads: 4
Current total threads: 13
Current busy threads: 9
Current queue size: 0
Max threads: 200
Min threads: 8
Idle Timeout: 60000
PID USERNAME NLWP PRI NICE SIZE RES STATE TIME cpu COMMAND
99802 axuser 115 59 0 2037M 1471M sleep 503:46 0.14% java
这怎么可能? top命令报告的用法多得多.我期望RES应该靠近堆非堆.
pmap -x,但是,报告堆中的大部分内存:
Address Kbytes RSS Anon Locked Mode Mapped File
*102000 56 56 56 - rwx---- [ heap ]
*110000 3008 3008 2752 - rwx---- [ heap ]
*400000 1622016 1621056 1167568 - rwx---- [ heap ]
*000000 45056 45056 45056 - rw----- [ anon ]
任何人都可以在这方面说明一下吗?我完全迷失了
谢谢.
更新
这在Linux上似乎不是一个问题.
另外,基于Peter Lawrey的回应,pmap报告的“堆”是本机堆不是Java堆.