Closed ozgurhangisi closed 5 years ago
Last night I changed this library and memory leak has gone.
May I see an example of a template you are using? Are you using any lambdas?
Having not had this issue myself before, given the environment, my first suspicion would be a zval perhaps having it's reference count incremented and not decremented.
If you're not set on having the specific mustache behavior, my other library uses an arena allocator and should be less susceptible to memory leaks outside of PHP: https://github.com/jbboehr/php-handlebars/
Hi,
It's various templates defined by my customers. But basically our templates are parameters with simple html. Something like
By the way I create Mustache object once and never release it. I always call $mustache->render function with the same object.
I have no lambdas. Just basic mustache implementations.
But I have lots of traffic and I call render function approximately 100 Millions times a day. Even if there is a small memory leak it has huge effect on my side.
Hi,
I was using this library (0.9.0) with swoole extension (it's a php cli deamon standalone web server). if I use $mustache->render($text,$array) method, memory always increases and server goes down after a day.
I can not see RAM usage with php's memoryget* commands but when I look at php processes with linux top command, php memory usage always increases.
P.S. = If I use {{{Non_encoded_variables}}} in the text, RAM increasing slowly (avg. server goes down for 24 hours later) but when I use {{HTML_ENCODED_VARIABLES}} in the text, RAM is increasing so fast and a few hours later server goes down and php process uses %100 of memory.
PHP Version : 7.3.7