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

Re: NSTimer problem


  • Subject: Re: NSTimer problem
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 26 Apr 2005 19:44:19 -0700


On Apr 26, 2005, at 7:25 PM, John Draper wrote:

- (void)startSending
{
// Create instance of the timer.
myTimer = [[NSTimer scheduledTimerWithTimeInterval:0.1
target:self

selector:@selector(trySynch:)
userInfo:nil
repeats:YES] retain];

// This is my callback the timer is supposed to call. But it's not getting called....
- (void)trySynch:(NSTimer *)Incoming_Timer
{
if (num_tries <= 0) {
NSLog(@"Stopped sending");
[myTimer invalidate];
myTimer = nil;

You are leaking timer instances because you retain it in your start sending method but don't release it before blowing away your reference to it. I suggest you simply don't retain it to begin with because the timer instance will continue to exist as long as it is scheduled to fire and for the life of the timer callback. In other words if you drop the retain your invalidate message will be sufficient.

Not sure if that is your problem or not (no idea how many you could be leaking) but I am confused by you saying your timer call back isn't called yet you say it hits your break point when you put on on the method?

Anything seen in the console when running this application?

Is there anyway I can get a list of allocated objects, kinda like a "heap dump"?
in OS_X?

/Developer/Applications/Performance Tools/

Consider ObjectAlloc.app, MallocDebug.app or even Shark.app.

A good thing to read...
<http://developer.apple.com/technotes/tn2004/tn2124.html>

-Shawn
 _______________________________________________
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: NSTimer problem
      • From: John Draper <email@hidden>
References: 
 >NSTimer problem (From: John Draper <email@hidden>)

  • Prev by Date: Re: Accepting All Drops
  • Next by Date: Re: Accepting All Drops
  • Previous by thread: NSTimer problem
  • Next by thread: Re: NSTimer problem
  • Index(es):
    • Date
    • Thread