Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualKhatharr

Posted 14 November 2012 - 06:33 PM

Why would you use a singleton to implement something that doesn't need implemented?

The _CRTDBG_LEAK_CHECK_DF flag effectively adds the memory leak dump as an atexit() call,


Additionally, there's absolutely no guarantee that instantiating 'first' will make that object deconstruct last. Additionally, if he's getting leaks from just including a header file then obviously he's got something doing allocations prior to main(), so being 'first' by instantiating in main isn't possible and there's explicitly no defined order for global or static initializations across compilation units.

#1Khatharr

Posted 14 November 2012 - 06:31 PM

Why would you use a singleton to implement something that doesn't need implemented?

The _CRTDBG_LEAK_CHECK_DF flag effectively adds the memory leak dump as an atexit() call,


Additionally, there's absolutely no guarantee that instantiating first will make that object deconstruct last. In fact, if he's getting leaks from just including a header file then obviously he's got something doing allocations prior to main(), so being 'first' be instantiating in main isn't possible and there's explicitly no defined order for global or static initializations across compilation units.

PARTNERS