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: Mon, 13 Dec 2004 11:05:33 +1000

Chris Gray wrote:
> That much being said, I'm not sure I agree with David's assertion. If the
> reference from a ThreadGroup to an unstarted Thread were a
> PhantomReference, then IMO it would be enough to associate that reference
> with some ReferenceQueue <rq>. <rq> needs to be scanned from time to
> time(*), and the undead threads removed from the ThreadGroup

Well I guess we'd have to quantify "overhead". The ReferenceQueue approach
doesn't require any array management, but there is a Reference per thread,
and extra overhead on Thread creation and start(). As long as there are few
unstarted threads that overhead should be fairly low, but it would be highly
variable depending on the application.

Looking at this from a real-time VM perspective I do not want to add such
unpredictable overhead to Thread creation or starting - but then I don't use
the Classpath Thread implementation. I'd adopt the current proposal without
the ReferenceQueue part.

I just don't think this particular leak is worth the cost of the fix. YMMV.

Cheers,
David Holmes





reply via email to

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