I'm having a really hard time making sense of you message...
> I have been trying to implement a 1 second repeating timer, but its
leading
> to retaining the target object

That's expected behavior - NSTimers retain their targets. The target won't
be deallocated until the timer has been invalidated (assuming the timer was
the only thing keeping the target alive.)

> But its leading to referencing the target object of my thread, by 3-4
> non-objects (bytes), which shows different descriptions every time as per
GC
> Monitor Instrument (kind of undefined behavior).

Woah, this sentence has my completely baffled:

 o Prior to this sentence, you were talking about retaining/releasing, not
you're talking about garbage collection. I think I'm still following you
though - regardless, the timer is keeping the target alive.

 o 3-4 bytes of what? Why do these bytes matter?

========== Moment of clarity in 3... 2... 1...

Oh. I think you're just trying to have a method called every second. If
that's the case, no need to concern yourself with threads and... well,
whatever it is that's going on in that code snippet. :D

   [NSTimer scheduledTimerWithTimeInterval: 1.0 target: self
selector: @selector(doSomething:) userInfo: nil repeats: YES];

That will call self's -doSomething: method every second. Is that what you're
trying to accomplish?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to