• 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
Extra retain count from loading nib with bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extra retain count from loading nib with bindings


  • Subject: Extra retain count from loading nib with bindings
  • From: Rick Hoge <email@hidden>
  • Date: Tue, 27 Jul 2004 14:33:41 -0400

I have noticed that when I load a nib using loadNibNamed:owner: I get extra retain counts.

For example

[NSBundle loadNibNamed:@"Progress" owner:self];

Bumps the retain count of 'self' by three. One retain is balanced by a release when I close the window associated with the bundle, and the other two seem to be caused by bindings in the nib file. Because the two retains from the bindings are not balanced, my object is never deallocated and I leak memory.

Obviously this is a problem, and seems to be a known feature (e.g. http://www.cocoadev.com/index.pl?NSBundle).

Is there an acknowledged best workaround for this? I can think of several kludges, all of which are kind of ugly. For example I could check the retain count immediately before and after loading the nib, and send an extra release for every extra retain count when I close the nib...

Any suggestions on how to deal with this would be very welcome.

Rick
_______________________________________________
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.


  • Prev by Date: Re: Formatter Hides String Value
  • Next by Date: Using NSApplescript while keeping UI responsive
  • Previous by thread: Re: Overlaying views to optimise drawing
  • Next by thread: Using NSApplescript while keeping UI responsive
  • Index(es):
    • Date
    • Thread