Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableDictionary autorelease chrashes application



On Jul 19, 2008, at 10:52 AM, Uli Kusterer wrote:
On 19.07.2008, at 05:52, Andy Lee wrote:
It's only when the ownership metaphor was applied that I questioned whether the abstraction holds up.

It's a metaphor, an abstraction. As those things go, they're bound to break down at some point.

Certainly, of course. But I'm sure I'm not the only person here who cares *where* a metaphor breaks down.


"ownership" works, because it's a term already taught in programming classes for more low-level languages (and even in good for higher- level garbage collected languages, because even there destruction order can matter).

I was a bit red-faced when Michael Ash pointed out that the term is commonly used to mean general responsibility for freeing memory. I'd honestly thought that Apple had made it up. Serves me right for not paying attention in class.


It may feel a bit odd, but thats because it works by analogy.

It only feels odd to me because the metaphor requires more stretching than in the case of, for example, the C++ String example. This is related to my discomfort with calling a retain count a reference count.


"autoreleased" in the context where an object is not added to a pool, however, leads to stale pointers and memory bugs, and may even lead to memory corruption and/or crashes. So I think I'll take an analogy hobbling in on its last leg over a label that leads to wrong code any day.

Yes, I've already admitted my suggestion was crappy. For the record, again, I've never used the term that way.


I rarely answer memory management questions, but I may answer some in the future just to get used to saying "you own it" or "you don't own it."

--Andy

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSMutableDictionary autorelease chrashes application (From: Matthias Arndt <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: Andy Lee <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: mmalc crawford <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: Andy Lee <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: j o a r <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: Andy Lee <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: "Michael Ash" <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: Andy Lee <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: "Michael Ash" <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: Andy Lee <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: "Michael Ash" <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: Andy Lee <email@hidden>)
 >Re: NSMutableDictionary autorelease chrashes application (From: Uli Kusterer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.