Non-document app's NSWindow keeps getting retained
j o a r
joar at joar.com
Tue Feb 5 15:28:44 PST 2008
On Feb 5, 2008, at 11:05 AM, David Dunham wrote:
> I've got a Cocoa app that manually creates an NSWindow (it's an
> easier fit for a cross-platform engine). From my debugging, it
> appears that every time I click another app's window, the retain
> count on my NSWindow goes up by 2 (I have a windowDidResignKey
> delegate which prints the retain count). I don't make an
> NSWindowController.
>
> If I override -[NSApplication windows] and return an empty array,
> the regain count doesn't keep climbing. This seems kind of odd.
>
> The behavior is happening on 10.4.11 and 10.5.1.
>
> I suspect I must be doing something wrong, but can't figure out what.
I suspect that you started to peek at the retain count of this window
for some specific reason? Why?
Like Scott suggests, tracking retain count is typically not an
effective way to troubleshoot memory management problems.
On Leopard you can use the Object Allocations instrument in
Instruments to track down where it is retained (On Tiger you can do
the same thing with the ObjectAlloc standalone app).
j o a r
More information about the MacOSX-dev
mailing list