I'm trying to find a memory leak in one of our applications, however it's quite elusive.
I've analyzed the program with Ants memory profiler and it found the leak to be in unmanaged code, for which Ants memory profiler is not suited: http://www.red-gate.com/supportcenter/content/ANTS_Memory_Profiler/help/7.4/amp_unmanaged_use I checked the things in the "graphics buffers" and "Problems with object disposal in unmanaged code" section, but that didn't give any results.
I then used the Windows debug diagnostic tool and did a memory pressure analysis. Majority of memory usage is in in the native heaps: heap 6 0x01ee0000 (not the default process heap). Virtual allocation summary memory is low and outstanding allocation summary memory in the leak analysis is low: none of the modules have high memory usage.
How do I find where the memory leak is located now?
Memory leak diagnostics is a built-in feature of the Microsoft CRT, the _CrtDumpMemoryLeaks() function provides a report. Using it requires writing unit tests in native code so that you can enable the debug allocator to make this function work. Which in turn requires that you have to source code for this unmanaged code so you can enable the debug allocator with the <crtdbg.h>
header file and can build the unit test. Essential guide is here.
The usual sticking point is that you don't have access to the native source code. In which case you'll need to work with the vendor or author of this code to get this problem sorted out. Get the ball rolling by providing him with a small repro project that demonstrates the problem.