• 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: Shawn Erickson <email@hidden>
  • Date: Fri, 25 Feb 2005 10:38:22 -0800


On Feb 25, 2005, at 10:23 AM, Mark Dawson wrote:

removing an object out of an array causes a release to happen (if there isn't a prior retain causing that object to be retained)

To insure clarity the above isn't true as worded (I think I know what you meant but)...

Arrays retain things when added and release them when removed (when an array is deallocated it implicitly removes all contained objects), it doesn't matter who or whatever else may have or may not have retained the object in question.

Make sure to understand that "release" does NOT imply an object will go away (aka be deallocated) it only means that the retain count has been reduced by one. If the retain count reaches zero, i.e. no one is retaining it any longer, then it will be deallocated by being sent a dealloc message.

In other words...

removing an object out of an array causes a release to be sent to it and the object possibly deallocated if there isn't at least a prior retain (implicit or otherwise) causing that object to have a non-zero retain count

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

  • Prev by Date: Re: Releasing what's in an array?
  • 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