• 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: Delayed Autorelease
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delayed Autorelease


  • Subject: Re: Delayed Autorelease
  • From: "Hank Heijink (Mailinglists)" <email@hidden>
  • Date: Thu, 8 Apr 2010 11:00:18 -0400

On Apr 8, 2010, at 10:36 AM, Patrick M. Rutkowski wrote:

> Is it common in either Cocoa or UIKit to have an autorelease run
> happen only when the user does something?

> I'm in a situation where I believe the autorelease run is happening
> only when I push a bush or otherwise fiddled with a UI item; might
> that be the case, or am I confused?

I think you may be confused here. There's no such thing as an 'autorelease run'. Autoreleased objects are collected in autorelease pools. The main autorelease pool in an application with a UI is drained every so often (every time the application goes through its main event loop).

You shouldn't have to worry about when autoreleased objects get released: the only thing you need to know is whether or not you're responsible for the release of an object. This is explained at length in the Memory Management Programming Guide:

http://developer.apple.com/mac/library/documentation/cocoa/conceptual/MemoryMgmt/MemoryMgmt.html

Also, check the documentation for NSAutoreleasePool.

Hope this helps,
Hank

>
> -Patrick
>
> P.S.
> Is there perhaps a way to have it logged to the console whenever an
> autorelease run happens?

I'm assuming you're referring to the draining of an autorelease pool again. Since the main autorelease pool is drained at the end of the event loop, I guess you could attach an observer to the main run loop (search the docs for runloop observer), but there may be better ways. Why would you want to know this?

> _______________________________________________
>
> 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
>

_______________________________________________

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

References: 
 >Delayed Autorelease (From: "Patrick M. Rutkowski" <email@hidden>)

  • Prev by Date: What is the best approach for custom tab bar interface?
  • Next by Date: Re: Delayed Autorelease
  • Previous by thread: Re: Delayed Autorelease
  • Next by thread: Re: Delayed Autorelease
  • Index(es):
    • Date
    • Thread