Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16201 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28662 invoked by uid 1010); 10 May 2005 15:12:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 5802 invoked from network); 10 May 2005 14:57:39 -0000 Received: from unknown (HELO php.net) (127.0.0.1) by localhost with SMTP; 10 May 2005 14:57:39 -0000 X-Host-Fingerprint: 212.112.227.169 ipx11223.ipxserver.de Linux 2.4/2.6 Received: from ([212.112.227.169:36317] helo=ipx11223.ipxserver.de) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id EF/34-35155-3EBC0824 for ; Tue, 10 May 2005 10:57:39 -0400 Received: from localhost (localhost [127.0.0.1]) by ipx11223.ipxserver.de (Postfix) with ESMTP id A63B7DF0121; Tue, 10 May 2005 16:58:05 +0200 (CEST) Received: from ipx11223.ipxserver.de ([127.0.0.1]) by localhost (ipx11223 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30828-04; Tue, 10 May 2005 16:58:02 +0200 (CEST) Received: from [192.168.0.101] (user-0cal1oq.cable.mindspring.com [24.170.135.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ipx11223.ipxserver.de (Postfix) with ESMTP id 25C92DF0155; Tue, 10 May 2005 16:58:02 +0200 (CEST) Message-ID: <4280CBE1.1040801@php.net> Date: Tue, 10 May 2005 10:57:37 -0400 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: lpedretti@suserver.com Cc: internals@lists.php.net References: <200505091130.56300.lpedretti@suserver.com> <200505101046.19099.lpedretti@suserver.com> <4280C47B.2070507@php.net> <200505101148.56888.lpedretti@suserver.com> In-Reply-To: <200505101148.56888.lpedretti@suserver.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by somedaemon at backendmedia.com Subject: Re: [PHP] Re: [PHP-DEV] make new return a reference to existent object From: lsmith@php.net (Lukas Smith) Leonardo Pedretti wrote: > Yes, the question was pointed in another way, the destructors are not called > until the last reference to an object has been removed, but if you store a > reference in an array so you lately return a reference to the already loaded > instance instead of creating an aliasing of that instance, then you get the > undesirable behavior that the object is never destroyed until the script > ends, because there is always a reference in that array and you can not check > when references are removed in any way. > And leaving the array growing while each object that exists in a huge database > is slowly loaded and never unloaded, is not an option. then dont store a reference to the object but instead just store the key in the array. regards, Lukas