views:

221

answers:

3

Hi,

I've got a Red Hat box with 6G memory running Tomcat and I'm trying 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: alt text alt text alt text alt text alt text

Added the free command screenshot: alt text

+1  A: 

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.

daedlus
+1  A: 

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).

Neil Coffey
+3  A: 

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.)

Stephen C
Thanks Stephen C, I have added the free command screenshot. I guess I don't have to worry about it then as caching is a good thing.
blackrocky
Is there a way to figure out which process is taking up the cache?
blackrocky
@black-rocky - no. The OS does not associate stuff in the disc block cache with any process. But it really doesn't matter because, as I said, pages in the cache will be reclaimed on demand.
Stephen C