On Jun 26, 2008, at 4:06 AM, Lukas Kahwe Smith wrote:
Now, upon execution of the code containing the closure, the new opcode just copies the zend_function structure into a copy, registers that copy
as a resource and returns that resource. As soon as the resource is
garbage collected (or explicitly unset), the op_array copy is destroyed. No modification of the actual class is done at all - the cache remains
happy.
So since a reference is stored, it means that the destructor of the enclosing object is only called once not only the variable holding the object, but also all lambda functions that were created inside of the class have been free'ed?


I'm not up to date on the operation of the current patches to implement closures, but typically this is how it'd work, retaining references to what's needed as long as the closures exist.

-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to