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

Newbie question: autorelease sends autorelease


  • Subject: Newbie question: autorelease sends autorelease
  • From: James Bucanek <email@hidden>
  • Date: Tue, 21 Sep 2004 20:25:23 -0700

Greetings,

I'm a fairly new to Cacoa programming and am in the process of creating my first major application.  I've got a few basic memory management questions that I can't seemed to find the answers to in the documentation.

First question: What happens to an object that gets autoreleased during the dealloc message of another object that is being released by an autorelease pool?

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?

(1) b gets added to the same NSAutoreleasePool that a belongs to, and that NSAutoreleasePool repeatedly releases objects until it is empty.

(2) b gets added to some other (next higher?) autorelease pool.

(3) b leaks.

Thanks,

James
--
James Bucanek <mailto:email@hidden>
 _______________________________________________
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: j o a r <email@hidden>
    • Re: Newbie question: autorelease sends autorelease
      • From: Chris Ridd <email@hidden>
  • Prev by Date: Scripting support problems
  • Next by Date: Newbie question: how to release an object that has been autoreleased
  • Previous by thread: Re: Scripting support problems
  • Next by thread: Re: Newbie question: autorelease sends autorelease
  • Index(es):
    • Date
    • Thread