Re: NSTimer memory management
Re: NSTimer memory management
- Subject: Re: NSTimer memory management
- From: Jeff Johnson <email@hidden>
- Date: Sun, 26 Sep 2010 10:34:14 -0500
On Sep 24, 2010, at 5:06 AM, Andreas Grosam wrote:
> On Sep 23, 2010, at 3:50 AM, Jeff Johnson wrote:
>
>> Your object retains the timer, and the timer retains your object. That is obviously a kind of retain cycle.
> I think, this kind of retain cycle is not a problem by itself when a repeating timer is used.
I don't see how a repeating timer makes a difference. The memory management is the same.
>> What can happen is that your app gets into a situation where the only thing that retains a reference to your object is its own theTimer ivar.
> This can not happen that easily when a repeating timer is used, since there must exist one other object holding a reference to the timer and invoking the -invalidate message. The reference to the timer is most likely an ivar of this other object, or the timer is indirectly retained by the other object (say, as an element of NSArray).
I think you misunderstood what I said. The "one other object" that you're talking about seems to be the same as "your object" that I was talking about.
_______________________________________________
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