   Do I have a memory leak?
  I'm using Visual C++ Express 2010 with _CrtDumpMemoryLeaks.  In a utility file I have:...namespace TerrainFileGenerator{    namespace    {   stack<string> errors;   ...    }    ...}..._CrtDumpMemoryLeaks only gripes about one possible leak in my code, and gives the location of the stack.  Is there something I should be doing to deallocate the memory for stack?  Or is _CrtDumpMemoryLeaks just complaining cause errors hasn't been deallocated before the end of main and I'm hyper paranoid?  _CrtDumpMemoryLeaks is the last call made in main.  Thanks!   
  If that's a global variable then yes - its destructor isn't called until the program is terminated, in other words - after the main().   ;  If you want to schedule a leak check for after globals have been destroyed _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); should work.   ;  Thanks guys, and I'll change it to use the debug flags instead.  I'd tried that before and it didn't seem to do anything--as in, it didn't give any output.   ;  It'll only give output if there is a leak. Try deliberately allocating memory that you don't release to test if it works or not.   