Visual C++ found memory leaks in my code so I whittled it down to as simplest test case as I could and got this:
#define _CRTDBG_MAP_ALLOC // required
#include <stdlib.h> // to enable MSVC++
#include <crtdbg.h> // memory leak detection
#include <string>
using namespace std;
int main() {
string foo;
_CrtDumpMemoryLeaks();
return 0;
}
Output:
Detected memory leaks! Dumping objects -> {130} normal block at 0x008748A8, 8 bytes long. Data: B4 F9 44 00 00 00 00 00 Object dump complete.
If I comment out "string foo;" it doesn't detect anything.
Should I be deallocating foo somehow?