ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Weighill Smith <phil.weighill-sm...@volantis.com>
Subject Re: report of ant holding on to thread refs in DemuxOutputStream
Date Mon, 25 Apr 2005 10:32:13 GMT
Perhaps you could use a ThreadLocal instead of the HashMap (if your mode
of use is always to access/manage the output stream for the current
thread)? The stored stream would be garbage collected when the thread
"goes away".

Phil :n.

On Mon, 2005-04-25 at 10:54 +0100, Steve Loughran wrote:
> 
> Forwarding bugrep from a friend. The implication is that  non-forked 
> Java code can cause trouble
> as the Demux logic hangs on to thread refs. I guess we could move to 
> weakrefs and purge sporadically (how sporadically ?).
> 
>  > We finally got to the bottom of the problem by switching to IBM's JVM
>  > and Heap Analyzer tool.
>  >
>  > It turns out that when a java task is running within Ant's JVM (i.e. not
>  > forked), System.out is redirected to an Ant class called
>  > org.apache.tools.ant.DemuxOutputStream. This keeps a HashMap which uses
>  > the Thread.currentThread()  as the key. Thus, a strong reference is kept
>  > to each Thread object that has ever written to System.out  (e.g. the
>  > java logging console handler). There are certain bursty client
>  > access patterns that cause Jetty of be continually varying the size of
>  > the its thread pool, by killing old threads and the later creating new
>  > threads. Put these things together and you have a problem! The Weak
>  > References also come into it, somewhere....
>  >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message