Just to keep it clear, this was put in last night- I guess johns patch
submission got held up somewhere.
Thanks to john for chasing this down, and testing the proposed fix so we
could get it into Vel 1.0.
some discussion below if anyone cares...
From: John McNally [mailto:[EMAIL PROTECTED]]
> This patch fixes a memory leak in texen, where the repeated use of the
> context without caching templates leads to introspection cache growth.
To be fair, it wasn't a memory leak, but rather a combination of factors
that caused new introspection information
to be repeatedly acquired and cached.
The fix to texen is in, and the situation is explained fully in the
developer docs under 'Other Context Issues'.
The long and the short is that in a tight loop, with template caching off,
getTemplate() was called and then that template was rendered with the same
VelocityContext for all iterations. This resulted in the template being
repeatedly reloaded and parsed, which made the introspection caching
information invalid in the VelocityContext, so it acquired new information
each time. There is no 'active expirer' in the VelocityContext (thank
$DIETY) to clean up, so the old information remained.
The possible solutions were one or more combinations of :
1) Turn on template caching.
and/or
2) Reuse the Template for each iteration since the template didn't change -
this would prevent the re-parsing.
and/or
3) Or wrap the populated VelocityContext in a 'fresh' context each time, so
that outer context would gather the introspection cache info, and it could
be discarded.
#3 was chosen. It works, and we got some good documentation out of it :)
geir