• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cleaning up a singleton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cleaning up a singleton


  • Subject: Re: Cleaning up a singleton
  • From: Andrew Merenbach <email@hidden>
  • Date: Fri, 23 May 2008 23:24:48 -0700

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


On May 23, 2008, at 11:07 PM, Sebastian Nowicki wrote:

Hi,
I have a bit of an odd problem, which may be the result of a bad design decision. My program wraps around a C library, which internally uses a global variable (structure) to manage things, and has functions to access the data. 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. Since singleton objects exist until the end of program execution, I assume dealloc wouldn't work with garbage collection. Calling dealloc on a singleton object doesn't even make sense. How would I handle this?


--
Sebastian Nowicki

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Cleaning up a singleton
      • From: Sebastian Nowicki <email@hidden>
References: 
 >Cleaning up a singleton (From: Sebastian Nowicki <email@hidden>)

  • Prev by Date: NSURLConnection canHandleRequest: succeeds even with no network
  • Next by Date: Re: Query about Zip command
  • Previous by thread: Cleaning up a singleton
  • Next by thread: Re: Cleaning up a singleton
  • Index(es):
    • Date
    • Thread