I have a requirement in which I need to show same window after some time.
So i have achieved it using [window setReleaseWhenClose:NO]
, but now the problem is that it keeps occupying 2MB of memory.
I want to have it like this that when i open it it uses 2MB of memory and when i close it it frees that memory, but still I should be able to re-open it.
If u have got any clues, that would be helpful.
Thanks
M.B.
If you want the memory to be released you have to release the window after it gets closed. If you need it again you always can reload the nib file. There is no way to keep the window loaded and release the memory at the same time.
To make this memory management easier you should use a NSWindowController
to manage the memory.
But I wouldn’t worry about 2 MiB of RAM. Keeping the window in memory might be preferable to loading it again when it’s needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With