Sergey wrote:
> I  got  horrible memory leaks: after 500 requests, Apache process grow
> by 45 megabytes!

That's (probably) not a memory leak.  It's TT keeping an in-memory cache of 
compiled templates.  That's what makes it so much faster.

> Now  I  think if I should forget about creating $tt2 handler on server
> startup...

If memory is a problem (and 45Mb for an Apache process doesn't seem like
a major problem to me - it's virtual memory and it's not unusual for Apache 
to show processes of many tens of Meg), then you can set the CACHE_SIZE to 
limit the number of templates the cache will hold (e.g. CACHE_SIZE => 64).
That might bring it down a little.

If you do revert to creating a TT handler for each request, then make sure
you set the COMPILE_DIR option to save compiled templates to disk.  e.g.
COMPILE_DIR => '/tmp/tt_compiler_cache'.  It's not as fast as a persistant
process with in-memory cache, but it does at least save TT from having to 
re-compile the same templates over and over again.

HTH
A


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to