• 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: Trying to understand -- please help...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to understand -- please help...


  • Subject: Re: Trying to understand -- please help...
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 21 May 2008 14:06:07 -0700

On May 21, 2008, at 10:36 AM, Sherm Pendley wrote:

[Objects] are simply released when the autorelease pool they are created in is released - which you can treat as occurring at the end of the method in which the init occurs.

Nonsense again. The autorelease pool is emptied at the end of each iteration through the event loop, and each iteration can encompass any number of method calls.

Actually, the original raises a valid point. It's true that the autorelease pool is emptied each time through the main event loop. However, methods are free to create their own autorelease pools -- folks do this when they know they're going to create a bunch of short- lived objects. The point is, whoever called you might pop an autorelease pool as soon as your method returns. There's no guarantee that autoreleased stuff will be dealloc'ed as soon as you return, but there's also no guarantee that it won't. In other words, if you want to keep it after you return, retain it.



--Chris N. _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Trying to understand -- please help...
      • From: "Sherm Pendley" <email@hidden>
References: 
 >Trying to understand -- please help... (From: Peter Hudson <email@hidden>)
 >Re: Trying to understand -- please help... (From: "Sherm Pendley" <email@hidden>)

  • Prev by Date: Re: Programmatically get treecontroller selection
  • Next by Date: Re: Trying to understand -- please help...
  • Previous by thread: Re: Trying to understand -- please help...
  • Next by thread: Re: Trying to understand -- please help...
  • Index(es):
    • Date
    • Thread