Aha, Scott Howlett pointed us to an existing bug that descibes this issue and includes a patch! It looks good to me, so I'm applying it now.
- Morgan --- Morgan Delagrange <[EMAIL PROTECTED]> wrote: > Hey all, > > We recently discovered a pretty serious memory > inefficiency in Jelly. Although it's not listed in > the Jelly issue tracker, there is a reference to it > elsewhere > (http://jira.codehaus.org/secure/ViewIssue.jspa?id=11194). > Basically Jelly uses ThreadLocal variables as a > performance optimization in two places: once in the > base TagScript class to allow thread-safety for > Script > instances and once in the JellyContext class to > cache > XML parser instances. > > The problem is that in environments using thread > pooling (e.g. Tomcat), the ongoing demands on memory > are considerable; basically many of the tags you > create is stored in memory in perpetuity for each > thread in the pool. Since the thread is never > garbage-collected, the tags stick around too. This > can easily lead to an out-of-memory condition. > > Looking at the code (which admittedly I do not 100% > understand), I don't see a good way to stop using > ThreadLocal variables without breaking thread-safety > for Script objects. This is not good. However, > eating up all the JVM's memory is also not ideal. I > will enter this as a bug, but this is the kind of > problem that needs to be addressed sooner rather > than > later. > > - Morgan > > > ===== > Morgan Delagrange > http://jakarta.apache.org/commons > http://axion.tigris.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > ===== Morgan Delagrange http://jakarta.apache.org/commons http://axion.tigris.org --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]