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

From: Date: Mon, 04 Feb 2013 10:57:35 +0000
Subject: Re: (non)growing memory while creating anoymous functions via eval()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-65627@lists.php.net to get a copy of this message
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?

« previous php.internals (#65627) next »