0

How do i get rid of the false memory leak message from CRT ?

I have a singleton class defined as:

Singleton & Singleton::GetInstance()
{
    static Singleton_instance;
    return _instance;
}

and it contains the member

std::vector<float> somefloats;

and my main look something like this

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
   ..
   _CrtDumpMemoryLeaks();
   return (int) msg.wParam;
}

It seems like the static instance is destroyed only after _CrtDumpMemoryLeaks() is called resulting in a false memory output from CRT. How do i get rid of these messages ?

0 Answers0