Re: persistent zval
| From: | Marc Bennewitz | Date: | Thu, 11 Dec 2014 18:46:43 +0000 |
| Subject: | Re: persistent zval | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79576@lists.php.net to get a copy of this message | ||
Am 10.12.2014 um 09:53 schrieb Stanislav Malyshev:
Hi!I'll experiment with it for scalars as extension. MarcWhy? 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.Because memory which is allocated by the engine is freed at the end of the request. You could copy the memory values but by then unless your zvals are pretty simple you'll be pretty close to what the serializer does, so no really big win there. The only advantage would be that when you use it, if you're really careful, then you can use the data without reallocating memory and freeing it. But it's not just putting a flag/refcount on it, it requires some copying before that and some careful setting of the refcounts too. So in theory, it can be done at least for scalars and arrays (objects would be a problem since they need class, and what if the class changed?) but it's not trivial. Thanks for the explanation!