Java runs out of memory, even though I give it plenty!

Posted by spitzanator on Stack Overflow See other posts from Stack Overflow or by spitzanator
Published on 2010-01-13T02:57:57Z Indexed on 2010/04/25 3:13 UTC
Read the original article Hit count: 310

Filed under:
|
|
|

Hey, folks.

So, I'm running a java server (specifically Winstone: http://winstone.sourceforge.net/ )

Like this: java -server -Xmx12288M -jar /usr/share/java/winstone-0.9.10.jar --useSavedSessions=false --webappsDir=/var/servlets --commonLibFolder=/usr/share/java

This has worked fine in the past, but now it needs to load a bunch more stuff into memory than it has before.

The odd part is that, according to 'top', it has 15.0g of VIRT(ual memory) and it's RES(ident set) is 8.4g. Once it hits 8.4g, the CPU hangs at 100% (even though it's loading from disk), and eventually, I get Java's OutOfMemoryError. Presumably, the CPU hanging at 100% is Java doing garbage collection.

So, my question is, what gives? I gave it 12 gigs of memory! And it's only using 8.2 gigs before it throws in the towel. What am I doing wrong?

Oh, and I'm using java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06) Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)

on Linux.

Thanks, Matt

© Stack Overflow or respective owner

Related posts about java

Related posts about memory