java.lang.OutOfMemoryError: unable to create new native thread for multiple threads
Posted
by
Kaustubh Ranjan Singh
on Stack Overflow
See other posts from Stack Overflow
or by Kaustubh Ranjan Singh
Published on 2014-08-24T04:14:15Z
Indexed on
2014/08/24
4:19 UTC
Read the original article
Hit count: 203
java
|multithreading
static class solver implements Runnable {
static calculator(problem){
//Some code
if(condition)
{solver s = new solver(newproblem);
new Thread(s).start();}
}
Public solver(int newproblem)
{
this.problem = newproblem ;
}
public void run() {
// TODO Auto-generated method stub
calculator(promblem);
}
}
i am having a big array maze of 100x100 and i am trying to solve it and i am getting an error java.lang.OutOfMemoryError: unable to create new native thread
(after running a code for some times). How can solve this , How can i use ExecutorService
i think that will solve the problem or i want something like this
If Number of generated threads>4K then stop the first 100 threads
© Stack Overflow or respective owner