[Templates] Memory leak
Andrew
andrew at guba.com
Fri Jun 27 22:35:17 BST 2008
We have a Catalyst application that we've recently switched from
Text::Tmpl to TT and we seem to be experiencing a significant memory
leak. Each apache process starts at 77mb and grows to around 100mb
during the first few requests. This was the steady state when using
Text::Tmpl. Now with TT, the processes continue to grow, and after about
2.5 hours, they hit 750mb and lock up the server. Less than optimal.
Our templates are a total of 600k, so it seems unlikely that this is
just cache. However, the leak does seem to come from the caching code as
setting CACHE_SIZE to 0 "fixes" the problem. (I say "fixes" because the
site works fine on the test servers, but causes the machine to thrash
wildly under any load).
Increasing the STAT_TTL (we tried 999_999) and seting COMPILE_EXT did
not diminish the leak.
We used _dump_cache() to inspect the cache as the process grew, and that
doesn't seem to be the problem. There is only one copy of any cached
file and cached files aren't being recompiled. Cache slots are moved
around, of course, but nothing is generated or destroyed. However
something is definitely not being freed, and it seems to be occurring in
the caching code.
In our test, we repeatedly hit a single url that would load a fixed data
set. As long as CACHE_SIZE is set to 0, any give apache process will
grow to around 100mb and stop growing. With CACHE_SIZE set to any other
value (or unset), the process will continue growing until it fills all
available memory.
Has anyone seen this before? This is with TT v2.19.
More information about the templates
mailing list