• 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: windowcontroller neccessary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: windowcontroller neccessary?


  • Subject: Re: windowcontroller neccessary?
  • From: James DiPalma <email@hidden>
  • Date: Tue, 14 Jan 2003 23:33:36 -0800

From: daniel oberhoff <email@hidden>
wont the principal NSApplication deallocate recources used by the main nib-file

From: James DiPalma <email@hidden>
There was some discussion months ago about not worrying about
NSApplication deallocing resources; when your app quits, all its
resources should clean up anyway.

From: matt neuburg <email@hidden>
But quittin'-time is not the only time that the file's owner might be deallocated.

Daniel asked specifically about NSApplication dealloc-ing resources from MainMenu.nib; NSApplication instances shouldn't worry about releasing top-level objects in their main nib.

And if the nib is not cleaned up at that moment, that's a leak (you're now using (much) more memory than you should be, and you've got a lot of nib objects still loaded but with no way to talk to them).

Yes, that would be a problem and is why I explained how NSWindowController releases top-level objects in nib files that it loads.

My original point was that if the file's owner is an NSWindowController then all of that is handled correctly, automatically. To me, that's reason enough to make every file's owner an NSWindowController (except MainMenu.nib, of course). m.

NSWindowController will release all top-level objects for nib files that it loads* even if it is not that nib's file's owner. PB's template files for a document based application use MyDocument as its nib's file's owner and an NSWindowController is magically instantiated and used to load that nib; all top-level objects will get released when that nib's document window closes.

Interestingly, an NSWindowController could be file's owner and be loaded manually with loadNibNamed:owner:; loaded in this way, this window controller would be unable to release top-level objects (never tested it myself, but I'm pretty confident if you don't ask for top-level objects at nib-load time, its hard to find them after nib loading).


-jim


* I remember some issues with calling -loadWindow directly that may prevent NSWindowControllers from releasing top-level objects. If you call -loadWindow, consider checking if top-level objects actually get released.
_______________________________________________
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: NSTask Path
  • Next by Date: Re: NSProxy
  • Previous by thread: Re: Fwd: windowcontroller neccessary?
  • Next by thread: Printing - PrintManager Driver Settings?
  • Index(es):
    • Date
    • Thread