Java / Tomcat memory leak in RedHat Linux?
I've got a Red Hat box with 6G memory running Tomcat and I'm tryin开发者_运维问答g to figure out how much memory I have left on the box. Problem is, top & jconsole is showing one figure (around 200M), and system monitor is showing a different figure (around 2G). Does anybody know what the difference is?
I'm not sure if there is a memory leak happenning here, but the highest memory consumer is a tomcat process that's taking 2.2G of memory.
Screenshots below:
Added the free command screenshot:
Clearly, top is telling you that Tomcat is only using 38% of your available memory. Your problem (if there is a problem) is with whatever is using the remaining 62% of memory.
I suspect that it is being used for disc block / file system caching. (Run the free
command and I expect that you should see a high value for "cached" that roughly corresponds in size to the missing pages.)
If your system has a large number of pages in the cache, it is a GOOD THING. All those cached disc blocks will make read access to your file system nice and fast. (And if the OS needs physical pages for something more important ... like running applications ... it can quickly reclaim them from the disc cache.)
the system monitor is showing how memory is being used by the tomcat process which is 2G[max heap size yo have set is allocated].
on linux try comparing it with free -m
which shows current free memory.
What does "free -t" display? I wonder if one of the figures is including cached file system data (which is used memory in the sense it's physically used for something, but free in the sense that it can be cleared out at any moment if necessary).
精彩评论