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.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to