• 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: Newbie question: autorelease sends autorelease
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question: autorelease sends autorelease


  • Subject: Re: Newbie question: autorelease sends autorelease
  • From: j o a r <email@hidden>
  • Date: Wed, 22 Sep 2004 09:26:57 +0200


On 2004-09-22, at 08.50, Chris Ridd wrote:

OK, so what's the answer to the original question then? :-)

Yes, exactly - if I'm so freaking smart, what's the bloody answer? ;)

A quick test tells me that the answer is (a). I could be wrong, but I think it's (a).

Example:

Object a retains object b.

Object a gets autoreleased.

When the NSAutoreleasePool gets dealloc'd, a gets released.

The dealloc handler for a sends an autoreleas to b.

What happens to b?

This is my guess:

"a" is deallocated in response to a release message sent from autorelease pool "p". "a" send autorelease to object "b" in it's dealloc method, causing "b" to be added to "p". When "p" continues through it's list of objects to release it will eventually reach "b" and send it a release message in the same "scope" as "a".

j o a r

_______________________________________________
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: Newbie question: autorelease sends autorelease
      • From: Chris Ridd <email@hidden>
References: 
 >Re: Newbie question: autorelease sends autorelease (From: Chris Ridd <email@hidden>)

  • Prev by Date: Re: Newbie question: autorelease sends autorelease
  • Next by Date: Re: Newbie question: how to release an object that has been autoreleased
  • Previous by thread: Re: Newbie question: autorelease sends autorelease
  • Next by thread: Re: Newbie question: autorelease sends autorelease
  • Index(es):
    • Date
    • Thread