• 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: 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


  • Follow-Ups:
    • Autorelease accessors, was Re: NSEnumerator retaining objects?
      • From: "Mike R. Manzano" <email@hidden>
    • Re: NSEnumerator retaining objects?
      • From: James Bucanek <email@hidden>
    • Re: NSEnumerator retaining objects?
      • From: "Geert B. Clemmensen" <email@hidden>
References: 
 >Re: NSEnumerator retaining objects? (From: James Bucanek <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: mmalcolm crawford <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: Shaun Wexler <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: j o a r <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: Shaun Wexler <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: j o a r <email@hidden>)

  • Prev by Date: Re: Weak linking frameworks?
  • Next by Date: Re: What NS Class is used to make movable menu bars?
  • Previous by thread: Re: NSEnumerator retaining objects?
  • Next by thread: Re: NSEnumerator retaining objects?
  • Index(es):
    • Date
    • Thread