> On 9 Dec 2014, at 19:45, Marc Bennewitz <dev@mabe.berlin> wrote:
> 
> 
> Am 09.12.2014 um 20:03 schrieb Sara Golemon:
>> On Tue, Dec 9, 2014 at 10:58 AM, Marc Bennewitz <dev@mabe.berlin> wrote:
>>> Is it possible to make a zval persistent?
>>> 
>> Nope.
>> 
> Why?
> 
> There is a reference counter, which should be increased on put a value into 
> persistence and on removing a value from persistence decrease it.
> So the GC could handle unreferenced zvals.
> 
> Example:
> persist_set($key, $value);
> persist_get($key);
> persist_has($key);
> persist_list(); // list of persistent values

No, no the GC couldn’t. All zval data is stored in non-persistent memory 
allocated with emalloc(). The allocator destroys all of that at the end of the 
request/script execution. So you’d now have a dangling pointer. Kabewm!
--
Andrea Faulds
http://ajf.me/





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

Reply via email to