On 24/05/2008, at 2:20 PM, Andreas Mayer wrote:


Am 24.05.2008 um 08:07 Uhr schrieb Sebastian Nowicki:

The library requires me to call a function which allocates memory to that global variable, and afterwards call a function which deallocates that memory. My singleton class calls the function to initialise in the init method, but I don't know how to deallocate the memory. [...] How would I handle this?

Um. You don't?

Since all memory is reclaimed when the application quits, deallocating a singleton to free memory is not necessary.

I can't be certain that the cleanup function won't do other things in the future, such as removing files (locks).

If, for some other reason, you need to act when the application quits, you can register for the NSApplicationWillTerminateNotification notification.


Andreas

On 24/05/2008, at 2:24 PM, Andrew Merenbach wrote:

Hi,

Would the following NSApplication methods, placed into your application delegate's code, help at all?

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
- (void)applicationWillTerminate:(NSNotification *)aNotification;

Of the latter, the docs say that one should "Put any necessary cleanup code in this method."

Cheers,
        Andrew


I guess that would be the way to go. Although I'd have to either expose a method that wraps around the C function, or call the C function directly. Neither are really optimal, but the latter is a lot better than nothing.

Thanks.

--
Sebastian Nowicki

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to