commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [jira] Commented: (JELLY-148) Huge memory leak resulting from the use of ThreadLocal
Date Fri, 24 Sep 2004 05:15:32 GMT
The following comment has been added to this issue:

     Author: Hans Gilde
    Created: Thu, 23 Sep 2004 10:15 PM
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:

View the issue:

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
             core / taglib.core

   Reporter: Hans Gilde

    Created: Sat, 18 Sep 2004 9:34 PM
    Updated: Thu, 23 Sep 2004 10:15 PM

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.

This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:

If you want more information on JIRA, or have a bug to report see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message