> On 20 May 2015, at 12:20 am, Steve Christensen <puns...@mac.com> wrote:
> 
> One thought I had was to base all your cacheable objects on a class whose 
> sole function is to notify the cache when the last reference goes away, i.e., 
> when dealloc is called


This is what NSDiscardableContent is able to do, though the method names it 
uses are not ‘retain’, ‘release’ and 'retainCount'. As it’s a protocol, not an 
object, you can implement it however you like.

I disagree (with Quincey) that you may as well use retain/release/retainCount 
because the point is that those things are called behind your back at times you 
do not control, which surely is why this is looking like such a difficult 
problem? Instead, if objects that access the cached objects are forced to use 
‘beginContentAccess’ and ‘endContentAccess’ then you have a very definite way 
to find out when nobody is accessing the objects that cannot be interfered with 
by memory management in any way.

I may have misunderstood the problem such that this is a poor ot for other 
reasons, but I’m not seeing it. I’m also not sure why there seems to be a tacit 
resistance to it - seems logical to me.

—Graham.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to