0

I develop a C++ DLL with Visual Studio 2017 and I have some memory issues. I would like to use Application Verifier to debug it but the application who runs my DLL (a third-party application) is also heap corrupted. So if I activate Application Verifier, the application crashes before my DLL is loaded.

Is it possible to say to Application Verifier to only take care of heap corruption of a DLL or a module? If not, is there a way to debug my DLL with another tool?

Pierre
  • 1,942
  • 3
  • 23
  • 43

2 Answers2

1

Why not write a simple wrapper app? I've had to do that for a third party DLL that caused heap corruptions that would later crash our app. In this case it was in the destructor so I only had to load and free it. But if that didn't find it for you you could add unit tests for each export.

GBrookman
  • 333
  • 1
  • 4
  • 13
  • Yes, it can be a good idea. But I forgot to mention there is a tight coupling between the DLL and the host application. – Pierre Mar 19 '19 at 13:50
0

As far as I kno Application verifier uses the global windows flags to detect leaks and heap corruption like this. So you can directly use the gflags tool to enable this functionality.

Please check the following discussion from Microsoft How to use gflags for finding heap corruptions.

KimKulling
  • 2,654
  • 1
  • 15
  • 26
  • I agree with that but can I activate gflags (or Application Verifier) only for the DLL? Because, when I use gflags/Application Verifier, my application crashes before my DLL is loaded because the third-party app is corrupted too and I can't edit it. – Pierre Feb 27 '19 at 09:20
  • As far as I know udmh shall be able to validate all heaps of your app: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/example-10---detecting-a-heap-memory-leak-in-a-process Hopes that helps. – KimKulling Feb 27 '19 at 09:28
  • I just fixed the posted link, now it gos to a tutorial how to debug heap corruptions with it. You can also run the application just in your debugger to find a solution for this by the way. – KimKulling Feb 27 '19 at 09:29
  • @Pierre If the third-party app is crashing because of appverif page heap I think you can specify to only use page heap for your DLL. Right click on Heaps and enter your Dll in the Dlls text box. If it's crashing regardless then I think you're out of luck. – GBrookman Apr 23 '20 at 17:38
  • provided url does not work – hfrmobile Dec 01 '21 at 07:49