C++ memory leaks with unordered_map
I've discovered that I have a memory leak somewhere in my application but
I've been having trouble narrowing it down. I've tried using the function
_CrtDumpMemoryLeaks as instructed in this example but it doesn't show file
names. So, I've been trying to find the first point of memory leaks (as
there seem to be quite a few according to the output) by placing calls to
this dump function at various points. It seems that I am getting a lot of
them straight away very early in my constructors for objects.
Upon further investigation, I seem to be getting them with definitions for
std::unordered_map even to the point where having a simple main function
that just declares a local variable has a memory leak.
For example the following code produces a memory leaks:
void main()
{
_CrtDumpMemoryLeaks(); // executing this line, no memeory leaks found
std::unordered_map<int, int> intMap;
_CrtDumpMemoryLeaks(); // executing this line, memeory leaks found
}
I'm completely confused at this point and get the feeling that chasing
this is not going to help me find the memory leak that I am originally
noticed.
Any help is very much appreciated.
No comments:
Post a Comment