dcsimg
ActiveCounts increasing steadily - Thread Leaks?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Keki_Bakshi
Posted On:   Monday, September 18, 2006 11:08 AM

In my code, I try the following: try { MyThread myThr = new MyThread(); // starting the thread myThr.start(); } catch(Throwable t) { t.printstacktrace(); } If start() fails, throwing the following error: java.lang.OutOfMemoryError: unable to create new native thread then the active count does not get reduced by 1. It seems to be a thread leak. Eventually the application crashes after many such errors. We tried to release the thread by placing myThr.stop(); myThr = null; but still it does not reduce the activeAcount.    More>>

In my code, I try the following:




try
{
MyThread myThr = new MyThread();

// starting the thread

myThr.start();

}
catch(Throwable t)
{
t.printstacktrace();
}





If start() fails, throwing the following error:
java.lang.OutOfMemoryError: unable to create new native thread then the active count does not get reduced by 1. It seems to be a thread leak.



Eventually the application crashes after many such errors.



We tried to release the thread by placing

myThr.stop();
myThr = null;


but still it does not reduce the activeAcount.


Please suggest a solution.

   <<Less

Re: ActiveCounts increasing steadily - Thread Leaks?

Posted By:   Edward_Harned  
Posted On:   Monday, September 18, 2006 12:45 PM

We need more information here.


It seems you're probably creating threads in a loop such that the MyThread... etc gets executed many times, thereby creating many threads.


So now the questions come up about why do such a thing? How are you controling the count of threads created? Do the threads you created die on their own? This list goes on and on.

About | Sitemap | Contact