Search code examples
objective-cmacoscocoansdocument

How to release memory after NSDocument window has closed?


I am working on a multi-window and document-based app. NSDocument handles the windows. Each document is about 80-100 MB in size.

When a window is closed, its memory footprint doesn't disappear at all. It seems that nothing is released whenever a window closes. Every delegate I've set should be self. Memory usage is pretty stable otherwise, but something is kept alive.

What could be causing this? Any hints where I could start debugging the problem?


Solution

  • My NSDocument implementation had a @property (nonatomic) NSWindow *thisWindow. The nonatomic property kept the whole window alive, even when set to nil.