• 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: How to use NSTimer correctly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use NSTimer correctly?


  • Subject: Re: How to use NSTimer correctly?
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Sat, 25 Jul 2009 08:29:22 -0700


On Jul 25, 2009, at 7:35 AM, Alexander Bokovikov wrote:


On 25.07.2009, at 19:56, Scott Ribe wrote:

If so, then where should I "dealloc" everything, I created in the
awakeFromNib? I believed that dealloc will be called when my
AppController will be released. But you say it is never released. Then
what should I do?

In dealloc, as you do now. But you need to arrange for dealloc to be called,
by making sure nothing (the timer) still retains you.

Could you explain it, how should I make the [dealloc] to be called? I've described, how I create a timer, so how should I free it to call dealloc? Should I explicitly call [self release] somewhere or should I do whatever else?

Your original post said you're trying to do this at quit, but you can't rely on any object being sent -dealloc at application quit time. Do your cleanup in applicationWillTerminate:, either as the app delegate or by registering for the notification. You definitely don't want to use [self release].


http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/20000043-SW4

Important: When an application terminates, objects may not be sent a dealloc message since the process’s memory is automatically cleared on exit—it is more efficient simply to allow the operating system to clean up resources than to invoke all the memory management methods. This has implications for how you implement a dealloc method—see “Resource Management.”


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: How to use NSTimer correctly?
      • From: Alexander Bokovikov <email@hidden>
References: 
 >Re: How to use NSTimer correctly? (From: Scott Ribe <email@hidden>)
 >Re: How to use NSTimer correctly? (From: Alexander Bokovikov <email@hidden>)

  • Prev by Date: Re: How to use NSTimer correctly?
  • Next by Date: Re: mouse entered/exited in nscollectionviewitem's view
  • Previous by thread: Re: How to use NSTimer correctly?
  • Next by thread: Re: How to use NSTimer correctly?
  • Index(es):
    • Date
    • Thread