Bug#420609: [php-maint] Bug#420609: memory leaks [ unfortunately continued ]

Steve Langasek vorlon at debian.org
Wed May 2 15:12:12 UTC 2007

On Wed, May 02, 2007 at 04:31:29PM +0200, .PaKud wrote:
> i'm sorry to tell that but it seems memory-leak problem similar to
> previous still occurs.
> when i run test as below i get continuous [ even increasing over time
> ] increase of memory usage.

> php4 [ PHP 4.4.4-8+etch2 ] on the same test does not leak any memory.

> p2back2:~$  php5 --version
> PHP 5.2.0-8+etch3 (cli) (built: Apr 29 2007 10:42:07)
> Copyright (c) 1997-2006 The PHP Group
> Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

> test by running:
> p2back2:~$ php5 -f a.php

> <?

> $last = 0;
> for( $i=0;$i<30000;$i++ ){
>        $y = '';

>        $y.=$i.$i.$i.$i;

>        $m = memory_get_usage();
>        echo $m." ".( $m-$last )."\n";
>        $last = $m;
> }

> thanks for your help.

While I can reproduce this behavior, I don't think it's a memory leak.  If I
raise the limit on $i high enough, I will get memory_get_usage() declaring
that more memory is allocated than is allowed by the memory limit setting in
/etc/php5/cli/php.ini -- and the memory usage reported by *top* remains
constant for the process throughout.

So this looks to me like a bug in memory_get_usage(), not a memory leak.

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon at debian.org                                   http://www.debian.org/

More information about the pkg-php-maint mailing list