[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Java 613 Threads limit: unable to create new native thread



> First of all: What error message do you get?

java.lang.OutOfMemoryError: unable to create new native thread

>How much memory do you have in the system?

2GB

> What is the output of  uname -a  on your system?

Linux de801.ispfr.net 2.6.18-028stab085.5 #1 SMP Thu Apr 14 15:06:33
MSD 2011 x86_64 GNU/Linux

> On my system, this program easily goes to 10000, although it demands a
> lot of memory. You may want to specify a lower stack size, like this:
>
> java -Xss150k DieLikeADog
>

It doesn't change anything, whatever i use for Xss, Xmx, or even
ulimit. It doesn't work also if I edit limits.conf

> Also, make sure you have sufficient memory available, basically the
> number of threads * memory required for an empty thread. Since each
> thread seems to take about 100k, this boils down to at least a GiB for
> 10k threads. YMMV. Note that on a 32-bit architecture, you will run out
> of address space long before running out of actual memory. While you
> could do crazy things with fork, I *strongly* recommend you use a 64-bit
> architecture.
>

I'm already using a 64 bit architecture.

> If you plan on having a quadruple-digits number of threads, I suggest
> you either rewrite your code to use threadpools or use really fast
> hardware with lots of memory (say, 10GiB)..
>

I plan on using around 2000 threads and the program will run extremely
fast, i'm sure of that. I just need to get rid of this system
limitation.


Reply to: