Re: { Semi-Newbie } Inverse of +initialize?
Re: { Semi-Newbie } Inverse of +initialize?
- Subject: Re: { Semi-Newbie } Inverse of +initialize?
- From: "John C. Randolph" <email@hidden>
- Date: Fri, 11 Oct 2002 15:01:29 -0700
On Friday, October 11, 2002, at 02:45 PM, Richard Kendall Wolf wrote:
Just curious ... is there any sort of an inverse of the +initialize
factory method? ... something like +cleanup? ... a factory method that
will be called for every class, say, just before an application
terminates?
No, but an app will send a notification before it terminates. Your
class can sign up for that notification and do whatever it needs when
the notification comes in.
... so that the class can deallocate any private data pointed to by
static variables?
I mean, I know it doesn't matter because the data will be freed anyway
when the application terminates ... it just rubs me the wrong way that
I can allocate storage in +initialize, but there is no way I can think
of to explicitly deallocate it other than use an NSApplication
delegate to free the data when a user quits the app ... or explicitly
when the application is a Foundation tool.
All this would do is make your app take longer to terminate. There's
no point to freeing memory when the app is quitting.
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.