I can't tell if there's something really obvious that I'm missing, but I'm writing a small game and I got some memory leaks using DrMemory. I couldn't figure out what was wrong exactly, so I wrote a simpler file that kinda modeled what my game was doing with memory.
class A{
public:
A() { a = new int[10]; };
~A() { delete[] a; };
private:
int* a;
};
int main()
{
A a;
return 0;
}
DrMemory is still telling me that I have a memory leak of two bytes, and I really cannot figure out what would be causing it. This is the error message that was generated
Error #1: LEAK 2 direct bytes 0x00da0c98-0x00da0c9a + 0 indirect bytes
# 0 replace_malloc [d:\drmemory_package\common\alloc_replace.c:2576]
# 1 msvcrt.dll!_strdup
# 2 .text [../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S:184]
# 3 __mingw_glob [../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S:184]
# 4 _setargv
# 5 .text
# 6 mainCRTStartup
# 7 ntdll.dll!RtlInitializeExceptionChain +0x62 (0x77849802 <ntdll.dll+0x39802>)
# 8 ntdll.dll!RtlInitializeExceptionChain +0x35 (0x778497d5 <ntdll.dll+0x397d5>)
How can I fix it? And can someone explain what the error is trying to say beyond the fact that there is a memory leak? Thanks!
There are no memory leaks, but possible a false positive.
Here is what I get when I run Dr. Memory:
I compiled with the default settings when I create a new project
and linker: