views:

172

answers:

2

I have a server application that runs on 64-bit Ubuntu server with 4Gb RAM. When I set JVM (We use Sun JVM 1.6) configuration parameters like this: -Xms1024m -Xmx2560m, I see a strange memory allocation when starting the application (It runs on Tomcat 6). Ubuntu's "top" command shows that the virtual memory size is almost 3,2Gb. I don't understand whether Ubuntu allocated the memory I asked for when starting the JVM, or maybe Ubuntu adds a part swap to the -Xmx value and thus I get this big size. If I run on 32-bit Ubuntu server and configure -Xmx1536m I see 1721m when running "top" command. Can anybody explain me what are those deltas and when they come from? I have other processes running on those instances and I want to understand what memory configuration I should apply for them taking into account the results of Ubuntu's "top" command.

Thanks in advance, Alex

A: 

Did you try out a Profiler like Yourkit?

megaflux
No, I didn't try the profiler.
Alex
A: 

The JVM will use a certain amount of extra memory for internal housekeeping purposes - this link may help:

Note also that the Permanent Generation is tacked onto the end of the Old Generation. There is also a small code cache of 50Mb for internal JVM memory management. This means that the total initial heap size = ‐Xms + ‐XX:PermSize + ~50Mb and that the maximum total heap size = ‐Xmx + ‐XX:+MaxPermSize + ~50Mb. For example, if –Xms/–Xmx are set to 512m and –XX:PermSize/MaxPermSize are set to 128m, the total VM will actually about 700 Mb in size.

Matthew Hegarty