PHP Possible Memory Leak
        Posted  
        
            by dropson
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by dropson
        
        
        
        Published on 2010-06-17T12:02:47Z
        Indexed on 
            2010/06/17
            12:13 UTC
        
        
        Read the original article
        Hit count: 278
        
I have a script that loops through a database for images to convert with gd & imagick.
I unset or replace all variables and objects in between each loop.
For each loop, get_memory_usage(1) reveals a concurrent amount of memory used by that script. Which is expected.
But, when I run "top", the %MEM column reports that this script, (same PID), increments with several percentages for each loop.
I destroy all images when I'm done with them, and when I run get_defined_vars(); only the standard globals and a few variables I have is set.
Why is "top" % Memory Usage different than what PHP reports?
After 10 loops, PHP has taken 20% percetage of the system memory.
I run php 5.2.6 on Debian 5
© Stack Overflow or respective owner