OutOfMemoryError: Unable to Start New Native Thread
i am running Java 1.4.2_08-b03 on Sun Solaris SunOS 5.9.
In my application i spawn off many short lived threads. (Now, the design of this is out of my hands, it is a multi-user system, and we make use of LDAP connections, so whenever a new connection is obtained, the Sun LDAP implementation would spawn a new short lived thread.)
i understand that typically the above error ("OutOfMemoryError: Unable to Start New Native Thread") occurs when there is insufficient memory in the NATIVE heap rather than the Java heap (controlled by Xms and Xmx), and also, the bigger the Java heap (set with Xms and Xmx), the smaller the native heap and the more likely to run into the error.
However, what i am facing is that i'm running into the error when i tweak some other GC settings (i.e. Xms and Xmx remain constant).
This gives no problem.
-Xms2048m -Xmx2048m -XX:MaxPermSize=256m
-Xms2048m -Xmx2048m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
If i use (2) or (3), i run into the OutOfMemoryError.
-Xms2048m -Xmx2048m -XX:NewSize=310m -XX:MaxNewSize=310m -XX:MaxPermSize=256m
The reason why i need to try (2) and (3), is that with (1), with the default new size, after sometime, the remaining space in tenured is unable to fulfil the young generation guarantee, and it ends up doing a major collection every time.
Any suggestions please? i urgently need help here.
Thanks in advance,