Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Gradually Increasing Memory

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
redAppleCore
Smarty n00b


Joined: 01 Aug 2013
Posts: 3

PostPosted: Wed Sep 11, 2013 4:22 pm    Post subject: Gradually Increasing Memory Reply with quote

I recently started testing out Smarty for use with a script that generates email templates, unfortunately for me it seems like Smarty isn't really intended to be used to generate large amounts of templates in a single process, and the memory balloons up over time. I've currently been able to slow this down by using a Runkit sandbox and running 500 templates at a time, which frees up the memory at the end, however it will still at it's peak use a significant amount of memory, and the cost of loading everything up in the sandbox every time is too expensive to cut the amount processed per cycle down much.

Has anyone else faced and solved this particular problem? I figure I might be on the completely wrong path here, but the functionality of Smarty has been amazing and I'd hate to have to give it up here.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Sep 11, 2013 7:13 pm    Post subject: Reply with quote

Smarty is indeed not intended to process an extreme large number of different templates in one run. It does cache template resources for typical applications where same (sub)template are called several times (loop) for best performance.

you can insert
Smarty_Resource::$sources = array();
Smarty_Resource::$compileds = array();
in your loop to free the resources.

But also compiled templates are PHP files which get included. So I'm not shure if the above will solve the problem completely....
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP