Hi,

On Fri, 2012-04-06 at 16:46 -0700, Luke Scott wrote:
> 
> 
> From what I've gathered thus far, it is impossible to do without
> copying the non-persistent memory into persistent memory, and then
> back again. I'm assuming this is because all the memory associated
> with PHP variables use emalloc, which places it onto a stack that is
> disposed of at the end of the request.
> 
> So there seems to only be two ways to do this:
> 
> 1 - Copy non-persistent memory into persistent memory (and back) using
> a deep copy. Probably not very efficient. May not be much better than
> serialization.

Yes, see apc_store() and friends to see all the small parts needed to
copy it as properly as possible. While this still won't work for all
cases (resources, internal classes, ..) but well, this might be what
you're looking for in a ready state ;-)

> 2 - Modify the Zend engine to flag objects/zvals as persistent so they
> aren¹t thrown away until the process ends.

Which is a major undertaking, taking copy-on-write and friends into
account. As in a case like

    mark_persistent($persistent);
    $persistent['some key'] = function_returning_lots_of_data();

would suddenly require to create a copy of all the data. Such things can
quickly cost more than recreating the structures more frequently ...

johannes



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

Reply via email to