• 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: strange NSWindowController memory leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strange NSWindowController memory leak


  • Subject: Re: strange NSWindowController memory leak
  • From: Georg Tuparev <email@hidden>
  • Date: Tue, 23 Nov 2004 12:15:52 +0100

To replay to my own question...

It is a Binding / IB bug (will file it next time when using the radar).

If one creates bindings, and later removes them from the NIB, the bindings are removed visually, but the NIB still has traces of them. This cause a bad memory leak (the Window Controller is retained many times and never deallocated).

The only solution I found is to redo the entire NIB. Bummer!

gt


On Nov 22, 2004, at 2:20 AM, Georg Tuparev wrote:

Folks,

I discovered a NSWindowController (non document based application) that leaks badly - to be more precise retain count is 10 instead of 1. When looking at this with ObjectAlloc I found following suspiciously looking retain events (all retains took place during Window Controller's showWindow method called immediately after initWithWindowNibName:):

Event: (#131046) ObjectRetainedEvent
Time Index: 122777726.693979
Category: NVLogViewerWindowController
Pointer: 0x642b50 Size: 160
Thread: 0x307 Extra Data: 0x3
Backtrace:
NSRecordAllocationEvent
NSIncrementExtraRefCount
-[NSObject retain]
-[_NSBindingInfo initWithController:key:valueTransformer:binding:]
-[NSBinder addBinding:toController:withKeyPath:valueTransformer:options:]
-[NSEditableBinder addBinding:toController:withKeyPath:valueTransformer:options:]
-[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:]
-[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
loadNib
+[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
+[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
-[NSWindowController loadWindow]
-[NSWindowController window]
-[NSWindowController showWindow:]
-[NVServerMonitorWindowController showLogWindow:] NVServerMonitorWindowController.m:50
-[NSApplication sendAction:to:from:]
-[NSControl sendAction:to:]
-[NSCell _sendActionFrom:]
-[NSCell trackMouse:inRect:ofView:untilMouseUp:]
-[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:]
-[NSControl mouseDown:]
-[NSWindow sendEvent:]
-[NSApplication sendEvent:]
-[NSApplication run]
NSApplicationMain
main() main.m:17
_start() crt.c:267
start


This looks like the buggy binding memory management discussed on this forum few months ago. Well, there are no NSControllers in this nib. But I remember that in a very early version, we were using NSArrayController bound to a NSPopUpButton.

Q1. Is it possible that although we do not use binding in this nib, the binding leak is still present after removing both NSArrayController and the NSPopUpButton?

Q2. If the answer of my first question is yes, how can I clean the mess without redoing the entire nib?
Georg Tuparev
Tuparev Technologies
Klipper 13
1186 VR Amstelveen
The Netherlands
Mobile: +31-6-55798196

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • NSController and NSCalendarDate
      • From: Andrew Salamon <email@hidden>
References: 
 >strange NSWindowController memory leak (From: Georg Tuparev <email@hidden>)

  • Prev by Date: Re: MRJ application builder
  • Next by Date: Re: Buttons with images in NSTableView
  • Previous by thread: strange NSWindowController memory leak
  • Next by thread: NSController and NSCalendarDate
  • Index(es):
    • Date
    • Thread