• 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: Releasing what's in an array?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Releasing what's in an array?


  • Subject: Re: Releasing what's in an array?
  • From: Mark Dawson <email@hidden>
  • Date: Fri, 25 Feb 2005 11:20:42 -0800


Does this mean that you have to do extra work if you release an array with objects that should NOT be released by you (i.e., objects you did NOT allocate)? A "more work" case would be an array of strings, some of which you allocated (and thus you should release), and some of which you got via getters (ones that you don't release). With something like that, would you have to keep track of what was allocated and what wasn't? Then iterate through the array, increasing the retain count for those that shouldn't be released (thus having leaving the retain count what it should be, after NSArray's dealloc releases everything)?

You must have missed my other email... but when the array is _dealloced_ it will send a release message to all objects that it contains before it itself is dealloced. If it didn't it would break with the expect memory contract when using Cocoa (in a nut shell "release what you retained or allocated (i.e. implicit retain) when you are done with it").

_______________________________________________ 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: Releasing what's in an array?
      • From: Shawn Erickson <email@hidden>
    • Re: Releasing what's in an array?
      • From: Charlton Wilbur <email@hidden>
    • Re: Releasing what's in an array?
      • From: Bob Ippolito <email@hidden>
References: 
 >Releasing what's in an array? (From: Mark Dawson <email@hidden>)
 >Re: Releasing what's in an array? (From: Shawn Erickson <email@hidden>)
 >Re: Releasing what's in an array? (From: Mark Dawson <email@hidden>)
 >Re: Releasing what's in an array? (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Please help a newbie with delegation!
  • Next by Date: Re: Releasing what's in an array?
  • Previous by thread: Re: Releasing what's in an array?
  • Next by thread: Re: Releasing what's in an array?
  • Index(es):
    • Date
    • Thread