2 Replies Latest reply on Sep 10, 2010 10:44 AM by jova73

    EJB and JNI: java.lang.OutOfMemoryError

    jova73

      Hi,

      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 DLL is consuming the heap.

       

      Do you think that a tuning of the memory for the threads (via Xss) should be a solution?

      Otherwise, loading the DLL in an external MBean can reduce memory occupation? Or maybe the problem would just be moved from the EJB side to the MBean side?

       

      Thanks in advance,

      Andrea