Eyal Koren
Eyal Koren

Reputation: 11

Native memory usage in Linux seems to be much higher than observed through JVM itself (e.g. through JConsole)

We have a customer that uses WebSphere 7.0 on RedHat Linux Server 5.6 (Tikanga) with IBM JVM 1.6. When we look at the OS reports for memory usage, we see very high numbers and OS starts to use SWAP memory in some point due to lack in memory. On the other hand, JConsole graphs show perfectly normal behavior of memory - Heap size increases until GC is invoked when expected and Heap size drops to ~30% in normal cycles. Non heap is as expected and very constant in size.

Does anyone have an idea what this extra native memory usage can be attributed to?

Upvotes: 1

Views: 1290

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533510

I would check you are looking at resident memory and not virtual memory (the later can be very high)

If you swap, even slightly this can cause the JVM to halt for very long periods of time on a GC. If your application is not locking up for second or minutes, it probably isn't swapping (another program could be)

If your program really is using native memory, this will most like be due to a native library you have imported. If you have a look at /proc/{id}/mmap this may give you a clue, but more likely to will have to check which native libraries you are loading.


Note: if you have lots of threads, the stack space for all these reads can add up. I would try to keep these to a minimum if you can, but I have seen JVMs with many thousands and this can chew up native memory. GUI components can also use native memory but I assume you don't have any of those.

Upvotes: 1

Related Questions