classpath
[Top][All Lists]
Advanced

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

RE: Memory leak in java.lang.Thread ?


From: David Holmes
Subject: RE: Memory leak in java.lang.Thread ?
Date: Fri, 10 Dec 2004 07:47:25 +1000

> I get an OutOfMemoryError. This is because new threads are added
> to their ThreadGroups in the Thread() constructor rather than when
> the thread is actually started. Therefore, even if they are never
> started they remain referenced an unable to be garbage collected.

Sun "fixed" this in Java 5.0. However, while the obvious fix is to clarify
what "active" thread means for ThreadGroup, they didn't update the spec but
simply decided they could interpret it how they wanted. So I can't tell you
exactly what they did because it is implementation detail.

I will note that you also have to consider what it means for a ThreadGroup
to be "empty" for daemon-ness and destroy purposes.

David Holmes





reply via email to

[Prev in Thread] Current Thread [Next in Thread]