>> SomeObject* foo_is_a_singleton = 0; >> >> void >> the_foobar_plugin_instantiator () { >> if (!foo_is_a_singleton) { >> foo_is_a_singleton = new SomeObject(); >> } >> ... the rest ... >> } > >This introduces a memory leak. You need to clean up the singleton on exit. i wasn't trying to show the whole thing. but your reply makes the point i was trying to make anyway :) yes, a singleton needs to cleanup at exit. what is "at exit"? we want it to be DLL-unload time, but can the language ensure that this happens with a static object? the C++ working group discussion suggests that it can. however, angus has described how OS X still has a problem in fulfilling this. as a result, it is not possible to get the static object to be cleaned up at the correct time by relying on language features. hence, the discussion. --p ---------------------------------------------------------------------- Generalized Music Plugin Interface (GMPI) public discussion list Participation in this list is contingent upon your abiding by the following rules: Please stay on topic. You are responsible for your own words. Please respect your fellow subscribers. Please do not redistribute anyone else's words without their permission. Archive: //www.freelists.org/archives/gmpi Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe