How to completely release every object allocated when opening a NIB file ?
How to completely release every object allocated when opening a NIB file ?
- Subject: How to completely release every object allocated when opening a NIB file ?
- From: Jérome Foucher <email@hidden>
- Date: Mon, 12 Jan 2004 10:15:29 +0100
Hi all,
I'm having big problems stopping my application from leaking.
- Here's the short story :
My app loads differents NIB files using
[NSBundle loadNibFile:path externalNameTable:NULL
withZone:NSDefaultMallocZone()];
The NIB file only holds a NSWindow which is set to release when closed.
The owner is a NSWindowController.
When the window closes, it's correctly released (I've traced it).
But each time I open such a NIB file and close the window, the
application's memory keeps increasing. I'm sure I release every object
that I've allocated, so this must be something allocated by Cocoa when
loading the NUIB file that is not automatically released.
- Here's the long story :
This app is supposed to run on a kiosk machine, and will run 24/24. It
will possibly load many different NIB files during its life, and even a
small leak is not acceptable.
My app acts as an interface client.
It runs an XML-RPC server. A remote computer can ask my app to display
a NIB file (to show an alert message, a dialog...). So it sends an
XML-RPC to my app with the path of the NIB file to load.
My app then loads it with [NSBundle loadNibFile....]
When the user clicks on a button, an XMR-RPC request is sent back to
the remote computer.
When the clicked button is OK or Cancel, the remote computer can decide
to close the dialog, and for that it issues an XML-RPC request to my
app.
When the dialog is closed, I'd like to release every possible object
that has been allocated when the NIB file was opened.
I do release the NSWindow. But Cocoa seems to allocate more objects
than what's in the NIB file. I have no clue what these objects can be.
Can anybody help me please ?
Thanks
Jirome
_______________________________________________
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.