Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65638 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34638 invoked from network); 4 Feb 2013 15:37:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2013 15:37:18 -0000 X-Host-Fingerprint: 195.42.115.214 de.p44.net Received: from [195.42.115.214] ([195.42.115.214:9938] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/00-34540-DA5DF015 for ; Mon, 04 Feb 2013 10:37:17 -0500 To: internals@lists.php.net,=?utf-8?Q?=C3=81ngel_Gonz=C3=A1lez?= Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes References: <510E9031.9040209@gmail.com> <510F941F.4090309@gmail.com> Date: Mon, 04 Feb 2013 22:37:09 +0700 Cc: "Terry Ellison" MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Message-ID: User-Agent: Opera Mail/12.12 (Win32) X-Posted-By: 195.42.115.214 Subject: Re: [PHP-DEV] (non)growing memory while creating anoymous functions via eval() From: petrich@tronic-media.com (=?utf-8?Q?Hans-J=C3=BCrgen_Petrich?=) Am 04.02.2013, 17:57 Uhr, schrieb "=C3=81ngel Gonz=C3=A1lez" : > Hans-J=C3=BCrgen Petrich wrote: >> Hi Terry and all >> thank you very much for your response. >> >>> The only thing that confused me about what you say that the second >>> *doesn't* grow >> Yes, about that i was [and am still :-)] also confused... why the 2nd= >> one won't grow *non-stop* >> >>> so I checked and it does -- just the same as the first. >> Right, it grows, but not non-stop as in the 1st one. >> >> The memory will stop growing (on my machine) at ~2491584 bytes and th= e >> loop is able to run forever, >> creating each eval() furthermore uniqe ano-function's but not >> endless-filling Zend-internal tables. >> >>> but this still leaves the function record itself in the >>> function_table hash so with a non-zero reference count and this >>> doesn't get DTORed until request shutdown >> Not familar with the Zend-internals but just about so i was imaging >> and expecting it. >> >> That why i [still] also confused/wondering why in the 2nd example the= >> memory will not grow *endless*. >> It seems that the function records in the function_table will be >> DTORed (or similar cleaned up) before request-shutdown at some point.= .. >> >> Could this be the case? > > As you are reassigning $ano_fnc, the old closure is being destructed. > Had you used create_function(), it wouldn't happen. > Now the question is, if it is correctly freeing the functions (and it = is > good that it does so), why is it not doing it when they have different= > lengths? > > > Now the question is, if it is correctly freeing the functions (and it = is > good that it does so), why is it not doing it when they have different= > lengths? Yes, you bring it to the point. Thats my question. Hoping of course that maybe it could be possible that freeing the memory also on different length. Thank you.