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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]