Re: release not done right away
Re: release not done right away
- Subject: Re: release not done right away
- From: j o a r <email@hidden>
- Date: Wed, 21 Apr 2004 13:47:35 +0200
On 2004-04-21, at 13.05, Nicolas Berloquin wrote:
>
ok I found what I believe is the guilty instance.
>
I'm using an NSTimer to prune my NBPeer after a couple seconds.
>
The NBPeer is inside the userInfo of the timer. And the Timer is an
>
autoreleased
>
object... which holds onto it until the main loop's pool autoreleases
>
it...
This is a common mistake to make. You can make an alternative
implementation that doesn't retain the object "subscribing" to some
action by having it register with a proxy object that holds the timer -
thus giving it the ability to de-register itself when it's being
deallocted, and also avoiding the extra retain count.
>
So I'll have to put all those timers inside my own pool that I cleaup
>
when I need to.
Inside an autorelease pool? Remember that the timers needs to be
invalidated, and not just released.
j o a r
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.