[php-maint] Bug#420609: memory leak in PHP 5.2.0-8+etch1

.PaKud kudzia at gmail.com
Mon Apr 23 14:07:11 UTC 2007

Package: php5
Version: 5.2.0-8+etch1

hi, i've noticed memory leak in php5-cli and libapache2-mod-php5 that
can be easily reproduced by running following code:

function x($a){
        $r = '';
        $r.=$a;         $r.=$a;         $r.=$a;
        return $r;

$last = 0;
for( $i=0;$i<1000;$i++ ){
        $y = x($i);
        $m = memory_get_usage();
        echo $m." ".( $m-$last )."\n";
        $last = $m;

when run with php4-cli [ PHP 4.4.4-8+etch1 (cli) ] after few dozens of
lines result is 0 - no memory increase, but when run with php5-cli [
5.2.0-8+etch1 ] results with continuous memory usage increase.

it seems problem is fixed in recent php 5.2 - i dont see this problem
in php5.2-200704230830 cvs snapshot.

ps. i'm using fresh debian etch installation with default php.ini files.

Pawel Kudzia / .PaKud / http://pqd.one.pl

More information about the pkg-php-maint mailing list