Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79522 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99247 invoked from network); 10 Dec 2014 08:53:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2014 08:53:49 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.172 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.214.172 mail-ob0-f172.google.com Received: from [209.85.214.172] ([209.85.214.172:55122] helo=mail-ob0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/BC-09154-B1A08845 for ; Wed, 10 Dec 2014 03:53:48 -0500 Received: by mail-ob0-f172.google.com with SMTP id va8so1885991obc.3 for ; Wed, 10 Dec 2014 00:53:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=peoLSnUABYzSaGmY7CO7AfAgfe0+xmcPZ8hHIv4VGYo=; b=djcqJfoGP14sWv1J2XKocMTbsbSglu+WvtxY4qNKwKKMwhDxz8eF2DAhqPsN/s1nKg EeJppN4Sr8i667XOynQyajVC2ZWONGbJDbjSr49RqSBQwohCkL+ItnHWhjyFcYh/ta2f bfXJ/lWhmslGek2OBc+NhItWw2Dtr7Oz/zJ/qa/15k9v2CoCsK6uDJWLo3jmEkoylyJo voOWt5EbXNiodCHc8Ha9Dgxl1EEN/euwmtfaYWpSfllRFmhnIXROl6WpjQuouQ82HitZ VA0SxPrWR0vAuQIY1GkaWh+4DznflZ57sCsLCqnIXeOXU9U9NjP3Eia96mkdiDY7O8J/ YqRA== X-Received: by 10.202.0.7 with SMTP id 7mr1724386oia.96.1418201624645; Wed, 10 Dec 2014 00:53:44 -0800 (PST) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id f206sm1726207oig.17.2014.12.10.00.53.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Dec 2014 00:53:44 -0800 (PST) Message-ID: <54880A15.50908@gmail.com> Date: Wed, 10 Dec 2014 00:53:41 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Marc Bennewitz , Sara Golemon CC: PHP internals References: <54874642.6080508@mabe.berlin> <54875152.3060808@mabe.berlin> In-Reply-To: <54875152.3060808@mabe.berlin> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] persistent zval From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > 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. 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. -- Stas Malyshev smalyshev@gmail.com