Debuggin memory leaks in Managed DX

Started by
1 comment, last by Pablo Alvarez 16 years, 7 months ago
Hi there! I'm experiencing some memory leaks in my application. I've enabled the DirectX Debug runtime and made it stop on the leaks, so I get the final report on the leaks after the Memfini debug message and my application stopped on the debugger at that point, but I was not able to find how to progress further. My report looks like this: Direct3D9: (INFO) :MemFini! Direct3D9: (ERROR) :Memory still allocated! Alloc count = 157 Direct3D9: (ERROR) :Current Process (pid) = 0000114c Direct3D9: (ERROR) :Memory Address: 025a07f4 lAllocID=1 dwSize=00004bc4, ReturnAddr=6bbf99aa (pid=0000114c) (...) Direct3D9: (ERROR) :Memory Address: 05834d3c lAllocID=284 dwSize=0000007c, ReturnAddr=6bc15d24 (pid=0000114c) Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 540328 bytes Could someone provide me with some info on how to debug it, on how could I get to know what objects area leaking? I googled a little but did not find proper info :( TIA, Pablo
Advertisement
Scroll down the list, find the first lAllocID value (1 in this case; it's something you allocate very early like the device itself). Set "break on AllocID" in the DX control panel to that value. You will then trigger a breakpoint at runtime when you allocate that object.

Alternatively, switch on over to SlimDX, which provides a more user-friendly debug dump when you forget to Dispose() a resource (it allows you to click on the error message and be transported to the initialization of the object you leaked, much like you can with compile errors).
Thanks a lot, jpetrie! I've just checked it and well, the breakpoint on the first allocID that appears on the list (in fact, the first allocation of them all) is showing something I'll have to investigate further. It is breaking on this line, just when it's getting the current display mode!

this.displayMode = Manager.Adapters[0].CurrentDisplayMode;


Thanks a lot for the info on SlimDX, I'll take a lookt at it, sounds nice!

This topic is closed to new replies.

Advertisement