Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12046 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76860 invoked by uid 1010); 10 Aug 2004 03:38:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 76825 invoked from network); 10 Aug 2004 03:38:52 -0000 Received: from unknown (HELO venus.tictek.net) (209.226.39.19) by pb1.pair.com with SMTP; 10 Aug 2004 03:38:52 -0000 Received: from Marshall (adsl-68-79-112-135.dsl.sfldmi.ameritech.net [68.79.112.135]) by venus.tictek.net (Postfix) with ESMTP id 96EBD320023 for ; Mon, 9 Aug 2004 23:38:17 -0400 (EDT) Message-ID: <002101c47e8b$8ea4dea0$3201a8c0@Marshall> To: Date: Mon, 9 Aug 2004 23:38:52 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Antivirus: avast! (VPS 0433-1, 08/09/2004), Outbound message X-Antivirus-Status: Not-Tested Subject: zend_list_addref and object resources From: marshall@magpcss.com ("Marshall A. Greenblatt") Hi, I'm having a bit of a conundrum that maybe someone here can help me out with :-). When assigning an object resource to either 'getThis()' or 'return_value' as shown below, is it necessary to manually increment the reference count? For example, /ext/ming/ming.c (version 1.70) contains many code fragments like the following where zend_list_addref() is used with 'getThis()', and not used with 'return_value': ret = zend_list_insert(action, le_swfactionp); object_init_ex(getThis(), action_class_entry_ptr); add_property_resource(getThis(), "action", ret); zend_list_addref(ret); ret = zend_list_insert(item, le_swfdisplayitemp); object_init_ex(return_value, displayitem_class_entry_ptr); add_property_resource(return_value, "displayitem", ret); Looking at earlier revisions of this file, it appears that usage of zend_list_addref() with 'return_value' has been steadily decreasing. There is, however, one place where zend_list_addref() with 'return_value' is still being called: int ret = zend_list_insert(shape, le_swfshapep); object_init_ex(return_value, shape_class_entry_ptr); add_property_resource(return_value, "shape", ret); zend_list_addref(ret); I can't find enough examples in other modules to feel confident that zend_list_addref() with 'return_value' is a bad thing (some use it, some don't), and my testing seems to show that everything works fine with or without the explicit zend_list_addref() call for both 'return_value' and 'getThis()'. That said, is there a "correct" way to handle reference counting with 'getThis()' and 'return_value' in this situation? Thanks, Marshall