Not showing file name and line number in leak dump
Saftur opened this issue · 1 comments
Saftur commented
I've been having this issue where VLD doesn't tell me file names and line numbers in the call stack.
main.cpp:
#include <iostream>
#include <vld.h>
/*#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>*/
#include "engine.h"
#include "levelmanager.h"
#include "opengl.h"
int main(int argc, char *argv[]) {
if (!Engine::init(&argc, argv))
return 1;
int *i = new int();
//Engine::getLevelManager()->load("Level1");
glutMainLoop();
Engine::shutdown();
//_CrtDumpMemoryLeaks();
return 0;
}
Output:
---------- Block 5 at 0x065FD190: 4 bytes ----------
Leak Hash: 0x2CDE864B, Count: 1, Total 4 bytes
Call Stack (TID 13128):
ucrtbased.dll!malloc()
GameProject.exe!0x00398C1D()
GameProject.exe!0x0033B2D2()
GameProject.exe!0x0039A43E()
GameProject.exe!0x0039A2E0()
GameProject.exe!0x0039A17D()
GameProject.exe!0x0039A4B8()
KERNEL32.DLL!BaseThreadInitThunk() + 0x24 bytes
ntdll.dll!RtlGetAppContainerNamedObjectPath() + 0x137 bytes
ntdll.dll!RtlGetAppContainerNamedObjectPath() + 0x107 bytes
Data:
00 00 00 00 ........ ........
The main.cpp has a new int()
which is never deleted, and since it's right in the main.cpp, it shouldn't be going through external dlls or some-such, and all of the memory leaks I can see show up like above.
Saftur commented
I found a solution to this. Go into 'Project Settings->Linker->Debugging->Generate Debug Info' and change that setting to "Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)"