Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54414 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43340 invoked from network); 6 Aug 2011 00:14:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2011 00:14:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=landeholm@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=landeholm@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.172 as permitted sender) X-PHP-List-Original-Sender: landeholm@gmail.com X-Host-Fingerprint: 209.85.210.172 mail-iy0-f172.google.com Received: from [209.85.210.172] ([209.85.210.172:47798] helo=mail-iy0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/90-37644-0578C3E4 for ; Fri, 05 Aug 2011 20:14:09 -0400 Received: by iye7 with SMTP id 7so3972544iye.31 for ; Fri, 05 Aug 2011 17:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ZccgWchWeaYhbdOgLg9YvIWsnurtE95V0MW0jzglrsU=; b=vqqvD770+V2QZNW7yf8t+6CC9iCame/3YDeUayiFJCbp5VvLorfOcbqoW0z9CZXlTx zWgN0Vyy1ZK5xmUDzsMKyk9MNOJCUsxxFJ1IkWni86VJeyO907d/jZcH2u4XrXvLkYD0 N93Vj2HoUH3hm2maV2PYKOpvKHxwYy4y75cow= MIME-Version: 1.0 Received: by 10.42.149.69 with SMTP id u5mr2716238icv.38.1312589645620; Fri, 05 Aug 2011 17:14:05 -0700 (PDT) Received: by 10.231.37.129 with HTTP; Fri, 5 Aug 2011 17:14:05 -0700 (PDT) In-Reply-To: References: <4E38EC0C.9080304@lerdorf.com> <4E38FA2E.4030605@lsces.co.uk> <4E38FC67.9090200@toolpark.com> <4E39E89F.8060605@sugarcrm.com> <4E3A3643.2070305@toolpark.com> <4E3A4793.2070209@sugarcrm.com> <4E3A91E8.1020107@toolpark.com> <4E3ACA42.8000001@sugarcrm.com> <4E3BF930.9030701@toolpark.com> <4E3C5EDE.3030401@toolpark.com> Date: Sat, 6 Aug 2011 02:14:05 +0200 Message-ID: To: Ferenc Kovacs , internals@lists.php.net Content-Type: multipart/alternative; boundary=90e6ba613b2490274f04a9cb177d Subject: Re: [PHP-DEV] [VOTE] Weak References From: landeholm@gmail.com (Hannes Landeholm) --90e6ba613b2490274f04a9cb177d Content-Type: text/plain; charset=ISO-8859-1 Good explanation Ferenc. Yeah I think there's a lot of misunderstandings going on with weak/soft references and how the garbage collector works. Weak/soft references is not some kind of solution to the cyclic reference problem. The GC takes care of that already. You can use whatever OOP patterns with whatever reference graphs you like Lars, the GC will free the entire structure as soon as the cyclic collector runs after you are not referencing it anymore. You might have become a bit confused with my last post where I explained how one could theoretically hack together a soft reference implementation by using weak references and some properties of cyclic collection. Also property access performance is off-topic. - Weak references solves the loose coupled object indexing problem. "I need this reference as long as it's referenced somewhere else." - Soft references solves the caching problem. "I need this reference as long as we have plenty of memory available." - The GC solves the cyclic reference problem (since 5.3). ~Hannes --90e6ba613b2490274f04a9cb177d--