Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58969 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73897 invoked from network); 15 Mar 2012 18:58:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2012 18:58:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=h.reindl@thelounge.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=h.reindl@thelounge.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain thelounge.net designates 91.118.73.15 as permitted sender) X-PHP-List-Original-Sender: h.reindl@thelounge.net X-Host-Fingerprint: 91.118.73.15 mail.thelounge.net Received: from [91.118.73.15] ([91.118.73.15:50430] helo=mail.thelounge.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/9C-16214-5DB326F4 for ; Thu, 15 Mar 2012 13:58:30 -0500 Received: from srv-rhsoft.rhsoft.net (openvpn-rh.thelounge.net [10.0.0.241]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.thelounge.net (Postfix) with ESMTPSA id B8CB69A for ; Thu, 15 Mar 2012 19:58:25 +0100 (CET) Message-ID: <4F623BD1.4080009@thelounge.net> Date: Thu, 15 Mar 2012 19:58:25 +0100 Organization: the lounge interactive design User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120314 Thunderbird/11.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: X-Enigmail-Version: 1.4 OpenPGP: id=7F780279; url=http://arrakis.thelounge.net/gpg/h.reindl_thelounge.net.pub.txt Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigB8F628AF5FA4EA9E21947C99" Subject: Re: [PHP-DEV] Small question about performance From: h.reindl@thelounge.net (Reindl Harald) --------------enigB8F628AF5FA4EA9E21947C99 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am 15.03.2012 18:41, schrieb Paul Dragoonis: >>> I don't really know when PHP frees temporary variables, but my guess >>> was that they are freed when the scope is left. >> >> Each variable has a refcount, then that hits 0 it can be freed up. >=20 > To add to that. A zval will have a refcount, so if you do $a =3D > someFunc(); then $a will have a refcount. >=20 > If you do something like $a =3D someFunc(anotherFunc(moreFunc())), the > return values of anotherFunc() and moreFunc() will be temp stored, but > they will _not_ have a refcount because they never got assigned into a > zval like $a. to make sure i understand this really function myfunc() { $b =3D internal_function_with_hughe_return_value(); return false; } $b is freed after the function has finished if not i should write a lot of unset() what is not possible if you have return $b --------------enigB8F628AF5FA4EA9E21947C99 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9iO9EACgkQhmBjz394Ank78wCfT6CIoKhfVNyooWSvMn6kKdoY cu4An1ZJsdgXLwRNw4JpyZLdSXc0ZQwW =OXQR -----END PGP SIGNATURE----- --------------enigB8F628AF5FA4EA9E21947C99--