Skip to Main Content

EJB and JNI: OutOfMemoryError

843829Sep 7 2010 — edited Sep 10 2010
I have a J2EE application running on JBoss 4.2.2 (Windows platform): I need to call a C DLL so I'm using JNI. After some time the application raises the following error

java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)

The JVM is started using 512MB as both min and max heap size (no other memory or stack options). The same app without the DLL integration runs fine so it seems to me that the problem is caused by the DLL integration via JNI. I've checked the DLL C code and memory is correctly released.
I tried to wrap the DLL with a MBean but I obtain the same error.
I've checked the virtual memory occupation of the JVM during the load test and it seems to grow faster with the DLL integration: without the DLL the virtual memory occupation is much more stable.

What do you think? Should I tune the garbage collector with some options?

Thanks in advance,
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Oct 8 2010
Added on Sep 7 2010