Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27594 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68625 invoked by uid 1010); 22 Jan 2007 22:22:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 68610 invoked from network); 22 Jan 2007 22:22:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jan 2007 22:22:09 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:24245] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/5E-07357-F0935B54 for ; Mon, 22 Jan 2007 17:22:09 -0500 Received: (qmail 931 invoked from network); 22 Jan 2007 22:20:26 -0000 Received: from office.zend.office (HELO ?127.0.0.1?) (192.168.16.109) by internal.zend.office with SMTP; 22 Jan 2007 22:20:26 -0000 Message-ID: <45B538F5.1030603@zend.com> Date: Mon, 22 Jan 2007 14:21:41 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0b1 (Windows/20061206) MIME-Version: 1.0 To: Lars Schultz CC: internals@lists.php.net References: <45B0E1EE.2030102@widescreen.ch> <45B123F5.3070803@zend.com> <45B3929B.8040803@widescreen.ch> <45B51124.90207@zend.com> <45B51AA8.8090307@widescreen.ch> In-Reply-To: <45B51AA8.8090307@widescreen.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP Object-Caching and Reference Counting From: stas@zend.com (Stanislav Malyshev) > I am not familiar with the term: "zval"...My understanding of php comes > from extensive usage...Can you give me a specific example? OK, sorry, got a bit into engine-speak, basically zval is the internal representation of a variable, more or less, though $foo and $bar can be linked to the same zval, and may be linked to different ones, depending on the context. The objects have its won refcounts internally, which means two unrelated variables can point to the same object. For these variables, both refcounts would be 1, but if you destroy any variable, object won't be destroyed since there's another variable pointing to it and the object knows that. So checking just refcount of the variable is not enough, since low refcount doesn't mean there's no variables referring to the object, only there's no "related" variables. If you want to dive into this in detail, I think the links recommended by Arnold Daniels would be a good start, especially in part talking about references and copies. > I also believe that my reasons for this feature only require that there > are not any less references than are returned by ref_count()...I am ref_count() can return small number and there can still be references to this object - just from another variable. So to be sure you would have basically to inspect both refcounts - variable's and object's. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/