Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54328 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52668 invoked from network); 3 Aug 2011 22:35:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2011 22:35:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:58785] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/F2-34160-12DC93E4 for ; Wed, 03 Aug 2011 18:35:14 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id A21835CFD for ; Wed, 3 Aug 2011 18:35:10 -0400 (EDT) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vUKGzts2jE2b for ; Wed, 3 Aug 2011 18:35:09 -0400 (EDT) Received: from djbondc (modemcable053.81-59-74.mc.videotron.ca [74.59.81.53]) by mail.ca.gdesolutions.com (Postfix) with ESMTPSA id 9E8265C4B for ; Wed, 3 Aug 2011 18:35:09 -0400 (EDT) To: "'PHP internals'" References: <4E3898B0.40809@sugarcrm.com> <4E38EC0C.9080304@lerdorf.com> <4E38FA2E.4030605@lsces.co.uk> <4E38FC67.9090200@toolpark.com> <4E39BA93.30601@lsces.co.uk> In-Reply-To: <4E39BA93.30601@lsces.co.uk> Date: Wed, 3 Aug 2011 18:35:08 -0400 Message-ID: <002101cc522d$99aed6c0$cd0c8440$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcxSIqggE5+rPiWtRAGu3xbqlS5M9gACFdkA Content-Language: en-ca Subject: RE: [PHP-DEV] [VOTE] Weak References From: jbondc@openmv.com ("Jonathan Bond-Caron") On Wed Aug 3 05:16 PM, Lester Caine wrote: > Jan Dolecek wrote: > > I was waiting for this for a while! I wrote a blog post how to get=20 > > best benefits from weak references: > > http://blog.juzna.cz/2011/08/weak-references-in-php/ > > Perhaps this will help showing people what are they good for. >=20 Or you can use various caching algorithms (LRU, MRU, ..) to reduce = memory usage: $this->cache =3D new ArrayLimit(2); $this->cache->add(new LargeObject('A')); $this->cache->add(new LargeObject('B')); $this->cache->add(new LargeObject('C')); $this->cache->count(); // 2 To solve a "caching problem" weak references aren't very helpful since = there's no way to know when or which objects will be garbage collected = (non-deterministic).