0

I'm running a Java application on Solaris using the -Xmx256M switch. When I connect via JMX, the JVM tells me the application is using about 50Mb of heap, and correctly states the maximum heap size is around 250Mb.

However, Solaris is telling me a very different story. When running pmap, for example, I get:

 ~ > pmap -S 10124 | grep heap

0002C000    3920    3920 rwx--    [ heap ]
00400000  815104  815104 rwx--    [ heap ]

Showing an incredible 800Mb of memory being used for heap space.

ps confirms the memory usage:

ps -eo vsz,rss,pid,args | sort -n

939368 925576 10124 /apps/../java -Xmx256M xxxx

I've read https://plumbr.eu/blog/why-does-my-java-process-consume-more-memory-than-xmx, but the article describes JVM using memory other than heap (i.e. stack, native libraries and threads) - but in my case, the JVM is actually using much more heap than specified.

My java version is:

java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) Server VM (build 20.6-b01, mixed mode)

To add to the mystery, I have other Java applications running on the same box, using the same JVM with the same settings, that behave perfectly fine. What makes this application "special" is that it connects to an external third party application (RET LBN, if that helps). It does not run any JNI or native code - so why is the third party library not respecting the JVM's startup parameters?

I'm at my wits end - any help or pointers will be greatly appreciated.

0

The Java heap is a block of memory that holds java objects.

"pmap" shows the Operating System process heap. This is the memory used to run the java process. This includes all the java code, plus all the C code that makes up the java run time environment.

To show the java heap try Memory tab of jconsole, or jmap or jstat.

  • Thanks Sean. I have done exactly that, and jconsole reports the maximum heap size to be 256Mb as expected. The question is really, why is the OS process using so much additional heap space? Any ideas on how I can find this out? – notdazedbutconfused Feb 10 '15 at 17:11
  • I would expect rss to be much closer to the Xmx setting. . Look at the output of pmap PID. You might see a .so file using a lot of memory. If it's making standard C library calls it might be more difficult to spot than if it's calling a custom shared library. – Sean McEligot Mar 18 '15 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.