Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8298 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75467 invoked by uid 1010); 2 Mar 2004 10:13:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75394 invoked from network); 2 Mar 2004 10:13:57 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 2 Mar 2004 10:13:57 -0000 Received: (qmail 4598 invoked from network); 2 Mar 2004 10:13:51 -0000 Received: from guardian.zend.office (HELO AndiNotebook.zend.com) (10.1.1.4) by mail.zend.com with SMTP; 2 Mar 2004 10:13:51 -0000 Message-ID: <5.1.0.14.2.20040302121341.028956f0@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 02 Mar 2004 12:13:49 +0200 To: Timm Friebe ,internals@lists.php.net In-Reply-To: <1077920715.846.1.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Memory leak with .= From: andi@zend.com (Andi Gutmans) References: <1077920715.846.1.camel@localhost> Fixed. Thanks for the reproducing case. At 11:25 PM 2/27/2004 +0100, Timm Friebe wrote: >The following script: > > class StringBuffer { > public $buf= ''; > > public function append($string) { > $this->buf.= ($string instanceof StringBuffer > ? $string->buf > : $string > ); > } > } > > $s= new StringBuffer(); > $s->append('Hello'); >?> > >causes: > >/usr/home/thekid/devel/php/php/Zend/zend_execute.c(4049) : Freeing >0x083B0310 (6 bytes), script=string.php >/usr/home/thekid/devel/php/php/Zend/zend_variables.c(137) : Actual >location (location was relayed) >=== Total 1 memory leaks detected === > >Changing the line $this->buf.= [...] to $this->buf= $this->buf. makes >the leak disappear. > >- Timm > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php