Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59385 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41216 invoked from network); 7 Apr 2012 00:23:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2012 00:23:26 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:40095] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/9E-57786-CF88F7F4 for ; Fri, 06 Apr 2012 20:23:25 -0400 Received: from [192.168.2.230] (unknown [88.217.64.240]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 148A7601CE; Sat, 7 Apr 2012 02:23:21 +0200 (CEST) To: Luke Scott Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Sat, 07 Apr 2012 02:23:15 +0200 Message-ID: <1333758195.7237.22.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Persistent zvals From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) 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