VM-Size in Windows task manager increases constantly. After 2 days java.exe

I got a big problem. Please give me some hints how to solve it. I read a lot of threads about it here, but no solution.

My system is:

P IV, 4GB mem (no swap to not delay the problem)

Windows 2003 Server x64

SUN JDK 1.5.0-07 for AMD x64

JBoss 4.04

My own stateful session bean and two servlets of my own

JBoss/JVM parameter:

set JAVA_OPTS=%JAVA_OPTS% -Xms2048m -Xmx2048m

set JAVA_OPTS=%JAVA_OPTS% -XX:PermSize=150m -XX:NewRatio=3

My problem is:

To stress test my bean I create approximately 600 instances. One hour after the start the windows task manager tells me a VM-Size of 2.5 GB. That抯 okay. Visual GC 3.0 tells me the following:

PermSize: 50MB(ok)

OldGen:300MB(ok) (after 2 collections)

Survivor ?130MB(ok)

Eden:170MB(ok)

Everything is okay.

After 30 hours Visual GC:

PermSize: 50MB(ok)

OldGen:300MB(ok) (after 500 collections)

Survivor ?8MB(interesting, but still ok for me)

Eden:33MB(interesting, but still ok for me)

The Problem is now windows task manager for java.exe

MemUsage:1.6GB(ok)

PeakMemIsage:1.6GB(ok)

VM Size3.5GB(and increasing: very big problem)

When VM-Size reaches 3.8GB, java.exe crashes.

IMHO JVM抯 internal heaps are okay but there must be an internal error in its memory management. It抯 not that I want memory returned to the OS but the JVM should detect a lack of fresh memory and not allocate anymore.

I also think that there is no benefit in changing Xms Xmx Xss (the well known switches). I tried without success.

Is it possible that this is a special problem of the x64 JVM? With 32 Bit I run onto other limitation.

Any help is welcome

Thanks in advance.

[1780 byte] By [camosa] at [2007-10-3 0:53:44]
# 1

I found the problem. It's inside the commons-fileupload-1.1.1 library (or my wrong usage of it) which creates a leaking File-Object each time a HTTP-Request is parsed.

See in DiskFileItem.java:

public OutputStream getOutputStream() throws IOException

{

. if (dfos == null) {

. . File outputFile = getTempFile();

. . dfos = new DeferredFileOutputStream(sizeThreshold, outputFile);

. }

. return dfos;

}

camosa at 2007-7-14 17:48:58 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

> I found the problem. It's inside the

> commons-fileupload-1.1.1 library (or my wrong usage

> of it) which creates a leaking File-Object each time

> a HTTP-Request is parsed.

>

> See in DiskFileItem.java:

That doesn't look like part of the Java API to me.

>

> public OutputStream getOutputStream() throws

> IOException

> {

> . if (dfos == null) {

> . . File outputFile = getTempFile();

> . . dfos = new

> DeferredFileOutputStream(sizeThreshold, outputFile);

>

> . }

> . return dfos;

> }

That looks like a bug in the code. Is that your code or the library cod? If yours fix it. If a library then verify you have the latest version and verify that a report does not exist then report it.

jschella at 2007-7-14 17:48:59 > top of Java-index,Java HotSpot Virtual Machine,Specifications...