Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54021 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25403 invoked from network); 18 Jul 2011 08:08:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2011 08:08:38 -0000 Authentication-Results: pb1.pair.com header.from=lars.schultz@toolpark.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lars.schultz@toolpark.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain toolpark.com from 195.49.42.12 cause and error) X-PHP-List-Original-Sender: lars.schultz@toolpark.com X-Host-Fingerprint: 195.49.42.12 mail1.screenlight.ch Received: from [195.49.42.12] ([195.49.42.12:57226] helo=mail1.screenlight.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/22-08769-40AE32E4 for ; Mon, 18 Jul 2011 04:08:37 -0400 Received: from [192.168.1.112] ([192.168.1.112]) (authenticated user lars.schultz@toolpark.com) by mail1.screenlight.ch (Kerio Connect 7.0.2 patch 1) (using TLSv1/SSLv3 with cipher AES256-SHA (256 bits)) for internals@lists.php.net; Mon, 18 Jul 2011 10:08:32 +0200 Message-ID: <4E23EA00.7090308@toolpark.com> Date: Mon, 18 Jul 2011 10:08:32 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: internals@lists.php.net References: <4E22DDD0.20105@toolpark.com> <4E23D124.50104@toolpark.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] weak references From: lars.schultz@toolpark.com (Lars Schultz) Am 18.07.2011 09:33, schrieb Hannes Landeholm: > Lars: Please don't break up my sentences and take them out of context before > you reply to them. (Hint: If a sentence begins with "so" it's not a good > idea to just reply to that sentence.) Sorry for misquoting you. I intended to make it clear to which passage I was replying. > If you are caching stuff you would rather want to use a strong reference > since the objects should be retained between "usages" _per definition_. You > might exploit weak references + destructor resurrection to achieve some kind > of on-demand, unorthodox caching mechanism but that would not be a primary > use cache for weak references, nor what you suggested (deallocate objects > when OOM is reached). I have also given an example of how weak references is > not necessarily used for caching, therefore not directly related to it. If > you want to continue to discuss "on demand deallocation", I suggest that you > start a separate thread. Why unorthodox? and isn't caching mostly done on-demand? Also SoftReferences would be perfect for caching since that data would be freed if memory consumption is high...but here I am, arguing your case. > I hope this will be more clear once the RFC is complete. I will then start a > separate thread for official discussion. All I wanted was to point out that introducing such a thing might overly complicate things for users not familiar with the concept...as the java guy pointed out in his intro, even java-people don't know about the feature, even though it's been around for 10 years (http://weblogs.java.net/blog/2006/05/04/understanding-weak-references). I'll be happy to read your RFC.