Re: NSEnumerator retaining objects?
Re: NSEnumerator retaining objects?
- Subject: Re: NSEnumerator retaining objects?
- From: John Stiles <email@hidden>
- Date: Wed, 9 Mar 2005 10:48:39 -0800
On Mar 8, 2005, at 10:12 PM, mmalcolm crawford wrote:
As far as I can tell, an NSEnumerator does not retain the collection per se. -nextObject does, however, retain and autorelease the object returned.
This clearly has implications for performance as well as memory management...
I must be missing something. How does [[myObj retain] autorelease] affect performance?
[myObj retain] incurs the overhead of:
objc_msgSend
retainCount++
[myObj autorelease] incurs the overhead of:
objc_msgSend
add one entry to the autorelease pool--it's unspecified how NSAutoreleasePool stores its entries but it is likely to be
very fast
Later on when the event loop drains, you have the overhead of:
objc_msgSend
retainCount--
compare retainCount with zero (it's non-zero since it was retained above)
So it's not zero overhead, sure, but I honestly wouldn't expect any of this to affect real-world performance measurements. Certainly not enough overhead to generate this much list traffic.
So is there another performance implication I'm missing?
_______________________________________________
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