Re: NSEnumerator retaining objects?
Re: NSEnumerator retaining objects?
- Subject: Re: NSEnumerator retaining objects?
- From: Marco Scheurer <email@hidden>
- Date: Wed, 9 Mar 2005 15:38:22 +0100
On Mar 9, 2005, at 13:49, j o a r wrote:
On 2005-03-09, at 13.26, Shaun Wexler wrote:
My point is that retain/autorelease performed by NSEnumerator is
redundant;
I have not argued with that. I don't know how it is implemented so I
can't say for sure, but it feels like it shouldn't be needed. I think
we agree on this point.
I checked with the version of frameworks I'm using, and sad but true,
objects are retained by nextObject!
This is IMHO a perfect example of the problems incurred by the
"autorelease accessors" school of thought. Everybody realizes what a
waste and potential performance issue it is, but we may have to stick
with that because some brain dead code may depends on this "feature".
returning a pointer to an object already retained by its collection
is unnecessary within the current thread's context, WRT -nextObject.
Going beyond a single-threaded app's needs may require additional
measures to manage object lifetimes. A properly written application
will not be broken if the retain/autorelease pair were removed from
the NSEnumerator nextObject implementation, and most Cocoa apps
should benefit from the performance increase.
I might not be reading you correctly, but it sounds to me like you
are talking about retain/release as having anything to do with thread
safety? If NSEnumerator uses retain+autorelease it's definitively not
in any attempt at thread safety.
Definitively not, but the argument that it does has been wrongly used.
Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden