• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSEnumerator retaining objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSEnumerator retaining objects?


  • Subject: Re: NSEnumerator retaining objects?
  • From: Shaun Wexler <email@hidden>
  • Date: Wed, 9 Mar 2005 03:25:37 -0800

On Mar 8, 2005, at 10:12 PM, mmalcolm crawford wrote:

Actually empirical investigation suggests that the documentation is at odds with the implementation.

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've filed a bug on this, although it's not clear to me whether it's the documentation that's at fault or the implementation (the documentation may be describing the intended behaviour).

Let's get rid of performance killers wherever possible! I'd rather see NSEnumerator _not_ retain the collection, nor retain/autorelease the returned objects. It's already documented not to be thread-safe to enumerate a mutable collection, and if you have to manipulate one using mutexes, retains would then be performed by your thread-safe accessor methods.
--
Shaun Wexler
MacFOH
http://www.macfoh.com


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: NSEnumerator retaining objects?
      • From: j o a r <email@hidden>
References: 
 >Re: NSEnumerator retaining objects? (From: James Bucanek <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Detect URL in NSTextView
  • Next by Date: Shading? Maybe just a blue background?
  • Previous by thread: Re: NSEnumerator retaining objects?
  • Next by thread: Re: NSEnumerator retaining objects?
  • Index(es):
    • Date
    • Thread