• 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: release not done right away
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >release not done right away (From: Nicolas Berloquin <email@hidden>)
 >Re: release not done right away (From: Nicolas Berloquin <email@hidden>)

  • Prev by Date: Change Highlight in NSTableView
  • Next by Date: Re: NSTreeController (was: Re: Cocoa bindings and NSOutlineView)
  • Previous by thread: Re: release not done right away
  • Next by thread: NSCell's editWithFrame method
  • Index(es):
    • Date
    • Thread