• 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 20:55:21 +0100


On Mar 9, 2005, at 20:46, Chris Kane wrote:

3) The enumerator class does NOT retain/autorelease every object returned from -nextObject. Marco's test case was too trivial to observe the real behavior: only the last object from the enumeration is retained/autoreleased, as -nextObject returns the last object. In Marco's test, there was only one object in the collection, so it was the one that got retained/autoreleased. The retain/autorelease is required because the collection is released in the same call, so the object could go away if the collection held the only retain.

Thanks, I'm relieved! And that's a good lesson, I should have thought of the last one being a special case.


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


References: 
 >Re: NSEnumerator retaining objects? (From: James Bucanek <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: Chris Kane <email@hidden>)

  • Prev by Date: Re: NSEnumerator retaining objects?
  • Next by Date: Re: NSEnumerator retaining objects?
  • Previous by thread: Re: NSEnumerator retaining objects?
  • Next by thread: Autorelease accessors, was Re: NSEnumerator retaining objects?
  • Index(es):
    • Date
    • Thread