7

An Apache Tomcat (Atlassian Confluence) instance is started using the following Java options:

JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true "

However I see that after starting up it quickly eats through most of the 1GB of memory that is available on my virtual server.

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 6082 root      19   0 1105m 760m  16m S  0.7 74.2   5:20.51 java

Shouldn't the overall consumed memory (heap + PermGen) stay under what is specified using -Xmx? One of the problems this is causing is that I cannot shutdown the server using the shutdown script since it tries to spawn a JVM with 256MB of memory which fails because of it not being available.

2
  • Maybe there's some native memory allocation going on via JNI or ByteBuffers with direct allocation. Commented Jun 29, 2011 at 20:56
  • @Steve Tayor Maybe... I don't know Confluence that well to know if it is doing that. I've posted a question on the Confluence forum but no answers yet. Commented Jun 29, 2011 at 21:09

2 Answers 2

5

For example, a native library can easily allocate memory outside Java heap.

Direct ByteBuffer also does that: http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html

The contents of direct buffers may reside outside of the normal garbage-collected heap, and so their impact upon the memory footprint of an application might not be obvious.

There are good reasons to allocate huge direct ByteBuffers.

http://ehcache.org/documentation/offheap_store.html

Sign up to request clarification or add additional context in comments.

Comments

3

Total Tomcat memory consumption should be calculated at NO LESS THAN Xmx + XX:MaxPermSize (in your case, 768MB), but I do recall seeing somewhere that it can go over that. Xmx is only the heap space, and PermGen is outside the heap (kind of).

2 Comments

heap + permgen + jvm overhead (unspecified amount)
@Wesho: Well, it could run in 512MB, you just need to adjust all your settings down accordingly. Perhaps Xms256m, XX:MaxPermSize=128m would do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.