Re: (non)growing memory while creating anoymous functions via eval()

From: Date: Mon, 04 Feb 2013 15:37:09 +0000
Subject: Re: (non)growing memory while creating anoymous functions via eval()
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-65638@lists.php.net to get a copy of this message
Am 04.02.2013, 17:57 Uhr, schrieb "Ángel González" <keisial@gmail.com>:

Hans-Jürgen 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 the 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.

Thread (15 messages)

« previous php.internals (#65638) next »