OutOfMemoryError : unable to create new native thread
843811Nov 6 2002 — edited Nov 7 2002I am using 1.3.1_06 on Sparc with Xmx Xms =2700m on a machine with 8g physical RAM. I am running an app with 1000 threads and frequently encouter the error "OutOfMemoryError: unable to create new native thread".
I am aware that the maximum addressable memory space in 1.3.1 is 4g and from my understanding is that the thread stacks are created in the memory space addressable by the VM that is in the headroom above my heap (the 2700m of space reserved by Xmx), but within the 4g of addressable memory space.
Sun Java documentation indicates that the default thread stack size on Sparc for 1.3.1 is 512m. If I have 1000 threads that means I need 500m of headroom. I have left 1.3g and I still get "OutOfMemoryError: unable to create new native thread" errors.
I have used -XX:ThreadStackSize to clamp down on my per thread stack size but I then encountered silent application errors which cause erradict unacceptable behaviour.
I would like to precisely understand how the JRE uses the addressable memory space above Xmx and within the 4g limit.
I am using -XX:-UseTLE as well but have played with this in test programs and it doesn't seem to have an effect on the available headroom for threads.