Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72348 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6452 invoked from network); 6 Feb 2014 20:32:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2014 20:32:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.47 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.212.47 mail-vb0-f47.google.com Received: from [209.85.212.47] ([209.85.212.47:39006] helo=mail-vb0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/40-04585-061F3F25 for ; Thu, 06 Feb 2014 15:32:33 -0500 Received: by mail-vb0-f47.google.com with SMTP id p6so1863210vbe.34 for ; Thu, 06 Feb 2014 12:32:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OcElpUy0yKlYufHxvkAoWq30W+fQJ5zfnSTjHhBKDCw=; b=g1x7GVZQblC9DZF/C53FqegXc/eNgaUKvLdO6w3wnex+RxZU9mBov4JuEz8PqMFzLw O/Jv8+jP8lC4q9iZZbT7krR6JimJ7776bPrNg1hbpUOW2iSI3w+Ux0lvwOlkmLq393W7 27wEZEZl83vFjYFR1ycCYGVH9K/1kWljSs4nWFJ3fxLD05mlZC/Ek17FdeKbja+9b9KX mFPecwyzxhwrvsxGwNA4X2G1foIEPzNEqC1wiYJWeZg5DBELyl7oyYanflHESGrBQhv1 hS5OwKEXMIGiyp2fYHmSRwYYQ7t3fEmBX86/m5pq2YLYBHTB2yvGYTpcEyt4fHvMxh5y 0RqQ== MIME-Version: 1.0 X-Received: by 10.58.84.230 with SMTP id c6mr11803vez.65.1391716962640; Thu, 06 Feb 2014 12:02:42 -0800 (PST) Received: by 10.58.133.229 with HTTP; Thu, 6 Feb 2014 12:02:42 -0800 (PST) In-Reply-To: References: Date: Fri, 7 Feb 2014 04:02:42 +0800 Message-ID: To: Ferenc Kovacs Cc: Bob Weinand , PHP Internals Content-Type: multipart/mixed; boundary=047d7bacbc0c2fbdbd04f1c25bea Subject: Re: memory leak in the new power operator tests From: tjerk.meesters@gmail.com (Tjerk Meesters) --047d7bacbc0c2fbdbd04f1c25bea Content-Type: multipart/alternative; boundary=047d7bacbc0c2fbdb704f1c25be8 --047d7bacbc0c2fbdb704f1c25be8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, On Fri, Feb 7, 2014 at 12:34 AM, Ferenc Kovacs wrote: > > > > On Thu, Feb 6, 2014 at 4:40 PM, Ferenc Kovacs wrote: > >> Hi, >> >> After Bob merged the pow related changes, executing the new tests with >> --enable-debug I've got two memory leaks: >> >> [tyrael@Ferencs-MacBook-Pro-135 php-src.git (PHP-5.6.0 =E2=9C=97)]$ cat >> ext/standard/tests/math/pow_variation1_64bit.diff >> ext/standard/tests/math/pow_variation2.diff >> 083+ [Thu Feb 6 16:20:51 2014] Script: >> '/Users/tyrael/checkouts/php-src.git/ext/standard/tests/math/pow_variat= ion1_64bit.php' >> 084+ /Users/tyrael/checkouts/php-src.git/Zend/zend_API.c(314) : Freeing >> 0x10D280C50 (72 bytes), >> script=3D/Users/tyrael/checkouts/php-src.git/ext/standard/tests/math/pow= _variation1_64bit.php >> 085+ /Users/tyrael/checkouts/php-src.git/Zend/zend_variables.c(141) : >> Actual location (location was relayed) >> 086+ =3D=3D=3D Total 1 memory leaks detected =3D=3D=3D083+ [Thu Feb 6 1= 6:20:51 2014] >> Script: >> '/Users/tyrael/checkouts/php-src.git/ext/standard/tests/math/pow_variat= ion2.php' >> 084+ /Users/tyrael/checkouts/php-src.git/Zend/zend_API.c(314) : Freeing >> 0x10CB8CBE0 (72 bytes), >> script=3D/Users/tyrael/checkouts/php-src.git/ext/standard/tests/math/pow= _variation2.php >> 085+ /Users/tyrael/checkouts/php-src.git/Zend/zend_variables.c(141) : >> Actual location (location was relayed) >> 086+ =3D=3D=3D Total 1 memory leaks detected =3D=3D=3D% >> >> not sure if these were originally in the PR or just something went wrong >> with the merge/cherry pick, but would be nice if somebody could look int= o >> it. >> thanks! >> >> -- >> Ferenc Kov=C3=A1cs >> @Tyr43l - http://tyrael.hu >> > > it seems the leak occures when pow() is called with an array: > [tyrael@Ferencs-MacBook-Pro-135 php-src.git (PHP-5.6.0 =E2=9C=97)]$ > ./sapi/cli/php -r 'pow(array(),2);' > [Thu Feb 6 17:32:43 2014] Script: '-' > Zend/zend_vm_execute.h(28951) : Freeing 0x1100B9ED8 (72 bytes), script= =3D- > /Users/tyrael/checkouts/php-src.git/Zend/zend_API.c(1011) : Actual > location (location was relayed) > =3D=3D=3D Total 1 memory leaks detected =3D=3D=3D > Not sure why that didn't pop up earlier; I've attached a patch that resolves the memory leak. One gotcha: the output of `pow(0, [])` is now `int(1)` instead of `float(1)`. I hope that's alright :) > > -- > Ferenc Kov=C3=A1cs > @Tyr43l - http://tyrael.hu > --=20 -- Tjerk --047d7bacbc0c2fbdb704f1c25be8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,


On Fri, Feb 7, 2014 at 12:34 AM, Ferenc Kovacs <= ;tyra3l@gmail.com= > wrote:



On Thu, Feb 6= , 2014 at 4:40 PM, Ferenc Kovacs <tyra3l@gmail.com> wrote:
Hi,

After Bob merged t= he pow related changes, executing the new tests with --enable-debug I'v= e got two memory leaks:

[tyrael@Ferencs-MacBook-Pro-135 php-src.git (PHP-5= .6.0 =E2=9C=97)]$ cat ext/standard/tests/math/pow_variation1_64bit.diff ext= /standard/tests/math/pow_variation2.diff
083+ [Thu Feb =C2=A06 16:20:51 2014] =C2=A0Script: =C2=A0'/Users/t= yrael/checkouts/php-src.git/ext/standard/tests/math/pow_variation1_64bit.ph= p'
084+ /Users/tyrael/checkouts/php-src.git/Zend/zend_API.c(3= 14) : =C2=A0Freeing 0x10D280C50 (72 bytes), script=3D/Users/tyrael/checkout= s/php-src.git/ext/standard/tests/math/pow_variation1_64bit.php
085+ /Users/tyrael/checkouts/php-src.git/Zend/zend_variables.c(141) : = Actual location (location was relayed)
086+ =3D=3D=3D Total 1 mem= ory leaks detected =3D=3D=3D083+ [Thu Feb =C2=A06 16:20:51 2014] =C2=A0Scri= pt: =C2=A0'/Users/tyrael/checkouts/php-src.git/ext/standard/tests/math/= pow_variation2.php'
084+ /Users/tyrael/checkouts/php-src.git/Zend/zend_API.c(314) : =C2=A0= Freeing 0x10CB8CBE0 (72 bytes), script=3D/Users/tyrael/checkouts/php-src.gi= t/ext/standard/tests/math/pow_variation2.php
085+ /Users/tyrael/c= heckouts/php-src.git/Zend/zend_variables.c(141) : Actual location (location= was relayed)
086+ =3D=3D=3D Total 1 memory leaks detected =3D=3D=3D%

=
not sure if these were originally in the PR or just something we= nt wrong with the merge/cherry pick, but would be nice if somebody could lo= ok into it.
thanks!

-- Ferenc Kov=C3=A1cs
@Tyr43l - http://tyrael.hu

it seems the leak occures when pow() is = called with an array:
[tyrael@Ferencs-MacBook-Pro-135 php-src.git (PHP-5.6.0 =E2=9C=97)]$ .= /sapi/cli/php -r 'pow(array(),2);'
[Thu Feb =C2=A06 17:32:43 2014] =C2=A0Script: = =C2=A0'-'
Zend/zend_vm_execute.h(28= 951) : =C2=A0Freeing 0x1100B9ED8 (72 bytes), script=3D-
/Users/tyrael/checkouts/php-src.git/Zend/zend_API.c(1011) : Ac= tual location (location was relayed)
=3D=3D=3D Total 1 memory leaks detected =3D=3D= =3D

Not sure why th= at didn't pop up earlier; I've attached a patch that resolves the m= emory leak.

One gotcha: the output of `pow(0, [])` is now `int(1)` = instead of `float(1)`. I hope that's alright :)
=C2=A0
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">

--
Ferenc Kov=C3=A1cs
@Tyr43l - http://tyrael.hu



--
--
Tjerk
--047d7bacbc0c2fbdb704f1c25be8-- --047d7bacbc0c2fbdbd04f1c25bea Content-Type: text/plain; charset=US-ASCII; name="php56-pow-memleak.patch.txt" Content-Disposition: attachment; filename="php56-pow-memleak.patch.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hrcg88m10 ZGlmZiAtLWdpdCBhL1plbmQvemVuZF9vcGVyYXRvcnMuYyBiL1plbmQvemVuZF9vcGVyYXRvcnMu YwppbmRleCAwM2RiYjE1Li45NzBiZDk0IDEwMDY0NAotLS0gYS9aZW5kL3plbmRfb3BlcmF0b3Jz LmMKKysrIGIvWmVuZC96ZW5kX29wZXJhdG9ycy5jCkBAIC0xMDI1LDEzICsxMDI1LDE1IEBAIFpF TkRfQVBJIGludCBwb3dfZnVuY3Rpb24oenZhbCAqcmVzdWx0LCB6dmFsICpvcDEsIHp2YWwgKm9w MiBUU1JNTFNfREMpCiAJCQkJaWYgKCFjb252ZXJ0ZWQpIHsKIAkJCQkJWkVORF9UUllfQklOQVJZ X09CSkVDVF9PUEVSQVRJT04oWkVORF9QT1cpOwogCi0JCQkJCWlmIChaX1RZUEVfUChvcDEpID09 IElTX0FSUkFZKSB7Ci0JCQkJCQlaVkFMX0xPTkcob3AxLCAwKTsKKwkJCQkJaWYgKFpfVFlQRV9Q KG9wMikgPT0gSVNfQVJSQVkpIHsKKwkJCQkJCVpWQUxfTE9ORyhyZXN1bHQsIDFMKTsKKwkJCQkJ CXJldHVybiBTVUNDRVNTOwogCQkJCQl9IGVsc2UgewogCQkJCQkJemVuZGlfY29udmVydF9zY2Fs YXJfdG9fbnVtYmVyKG9wMSwgb3AxX2NvcHksIHJlc3VsdCk7CiAJCQkJCX0KLQkJCQkJaWYgKFpf VFlQRV9QKG9wMikgPT0gSVNfQVJSQVkpIHsKL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