Detect leaks in DLL

Jan 22, 2013 at 8:51 PM

This has probably been asked, but I have a DLL that I need to debug, but I do not 'own' the executable. My DLL is a loadable plugin to an existing product, so I am limited to the code inside the DLL.

The executable runs as a Windows service. I compiled my DLL with the vld.h header file and built it, then let it load in the running service. I ran it for sometime, stopped the service but I was not able to find any report dump in the exe or dll folder.

What's the best approach for this?

Jan 22, 2013 at 8:56 PM

You should try enter full path to log file in vld.ini (directory should exist)

Jan 22, 2013 at 9:22 PM

Tried that. Here is a snippet:

ReportFile = c:\MyLogs\memleak.txt

; Sets the report destination to either a file, the debugger, or both. If
; reporting to file is enabled, the report is sent to the file specified by the
; ReportFile option.
;   Valid Values: debugger, file, both
;   Default: debugger
ReportTo = file

I assume the path does not need quotes. This is a 64 bit machine, but both the service and DLL are 32 bits, for what that's worth. Would the ini file be read when the DLL is loaded, then flush the debug data when the service is stopped or DLL gets unloaded? I've successfully used this tool before, but not in this context.

Jan 25, 2013 at 8:28 AM

I have exactly the same challange.

I need to check just my DLL code from loading until the Main-EXE is closed and the DLL is released.

I read somewhere to exclude an EXE from being checked, but how's this done?