.PaKud wrote: > Betreff: Bug#420609: [php-maint] Bug#420609: memory leaks [ unfortunately continued ] > Steve Langasek wrote: > > > > So this looks to me like a bug in memory_get_usage(), not a memory leak.
> heh - you are most probably right - there was also other fishy > behavior of memory_get_usage reported in php 5.2 at > http://bugs.php.net/bug.php?id=39652. but still i have a hunch that > there is something not right: i have peace of code that works as > daemon and i started to experience increasing memory usage over time > ended with memory allocation errors after moving it from php4 to php5. > i'll keep on investigating. I've seen huge memory leaks in 5.2.0-10; unfortunately I wasn't able to strip the code down to a 10 liner. In my case it seemed to be caused by copying array elements from one array to another (like, but not exactly behaving like array_merge()), as in: function abc($a1, $a2) { foreach ($a2 as $var=>$val) { if (!isset($a1[$var])) { $a1[$var] = $a2[$var]; } } return $a1; } And that function was called from within a directory walker. In my case this function was called ~200 times, with $a1 constantly growing up to ~50kB data. php-cli's mem usage (as reported by top) went up to 600M and finally died with OOM. Even unset()ting didn't help in my case, so I did a complete rewrite using (ugly) array references. Perhaps this helps someone tracking down the problem Kind regards Thomas