commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dion Gillard <dion.gill...@gmail.com>
Subject Re: [jira] Commented: (JELLY-148) Huge memory leak resulting from the use of ThreadLocal
Date Fri, 24 Sep 2004 05:52:13 GMT
Maybe caching could be disabled via a context variable?


On Thu, 23 Sep 2004 22:15:32 -0700 (PDT),
commons-dev@jakarta.apache.org <commons-dev@jakarta.apache.org> wrote:
> The following comment has been added to this issue:
> 
>      Author: Hans Gilde
>     Created: Thu, 23 Sep 2004 10:15 PM
>        Body:
> Putting the thread local stuff in the JellyContext makes the memory leak go away as soon
as the context is disposed of. Depending on how you use the context, the XMLParser might keep
a reference to it. And it will have varying amounts of data in it depending on your "export"
setting... this is all *if* we implement the tag cache in the context.
> 
> The Servlet stuff doesn't reuse the context or the parser so there's no leak for Servlets.
But others might reuse the context, I know that I do.
> 
> So, we have a few choices:
> 
> 1) Let it leak memory into the context, tell people to trash the context and the parser
as often as possible. If you don't, tough luck, you get a memory leak.
> 
> 2) Implement a context method to clear the cache, tell people to clear the cache as often
as possible. Clearing the cache will harm only those scripts that keep references to their
body Script, like Swing Action or WindowListener.
> 
> 3) Use the WeakReference thing, and tell everyone "if you want to use Action tags, where
the action is a Jelly tag (as opposed to a class that implements ActionListener), you have
to keep the Jelly Script around as long as the Swing screen stays up".
> 
> 4) Some other solution that I can't think of due to my recent lack of sleep.
> 
> Any suggestions/votes? I think I like #3.
> 
> ---------------------------------------------------------------------
> View this comment:
>   http://issues.apache.org/jira/browse/JELLY-148?page=comments#action_53372
> 
> ---------------------------------------------------------------------
> View the issue:
>   http://issues.apache.org/jira/browse/JELLY-148
> 
> Here is an overview of the issue:
> ---------------------------------------------------------------------
>         Key: JELLY-148
>     Summary: Huge memory leak resulting from the use of ThreadLocal
>        Type: Bug
> 
>      Status: Unassigned
>    Priority: Critical
> 
>     Project: jelly
>  Components:
>              core / taglib.core
>    Versions:
>              1.0-beta-5
> 
>    Assignee:
>    Reporter: Hans Gilde
> 
>     Created: Sat, 18 Sep 2004 9:34 PM
>     Updated: Thu, 23 Sep 2004 10:15 PM
> 
> 
> 
> Description:
> There is a huge memory leak that results from the TagScript's use of ThreadLocal.
> 
> ThreadLocal is usually used from a staic variable, while TagScript uses it from an instance
variable. Although this looks legal to me, it causes a huge memory leak.
> 
> ---------------------------------------------------------------------
> JIRA INFORMATION:
> This message is automatically generated by JIRA.
> 
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> 
> If you want more information on JIRA, or have a bug to report see:
>    http://www.atlassian.com/software/jira
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 



-- 
http://www.multitask.com.au/people/dion/

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


Mime
View raw message