java.lang.OutOfMemoryError: unable to create new native thread for multiple threads
- by Kaustubh Ranjan Singh
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 thisIf Number of generated threads4K then stop the first 100 threads