users@glassfish.java.net

System reporting Glassfish as using twice Xmx limit - why?

From: <glassfish_at_javadesktop.org>
Date: Sat, 08 May 2010 22:15:16 PDT

Running Glassfish 2.1.1 on Ubuntu 9.10 64bit, with Java 1.6.0_20-b02 64bit.

I've recently noticed that Glassfish is taking up a lot more of my system memory than I would have expected. I'm not sure why this is, so I'm asking here.

My problem is that it was taking up 1.1GiB of RAM (~1/4 of total), which is quite a lot. Looking in domain.xml, I see that it has the JVM options -Xmx512m and -XX:MaxPermSize=192m.

I would have assumed (and this is possibly just my faulty understanding of how memory works in Java) that this would mean Glassfish wouldn't be eating more than 512MiB of RAM. However, as I said above I noticed the System Monitor said Glassfish was using 1.1GiB, more than twice that.

Also, when I do an undeploy/deploy cycle ./asadmin undeploy / deploydir commands, it managed to use an extra 300MiB or so of RAM (which suggests that I have a major classloader leak somewhere, but that's another issue entirely). Thing is, that took Glassfish to over 800MiB, according to the system monitor and that's not what I was expecting.

So what's up? Do I just have a faulty understanding of how Java works under Linux? Is there some strange bug in Glassfish that's eating all of my memory? Is this related to the fact that I have what appears to be an absurd amount of memory leaking somehow?

I'm not even sure that this is the right forum to post this in, but I've been noticing this behaviour only with Glassfish. Eclipse eats up lots of memory too, but at least I explicitly set that to have an Xmx of 1024MiB.
[Message sent by forum member 'ipsi']

http://forums.java.net/jive/thread.jspa?messageID=469061