Determining If a Driver Leaks Framework Objects
This topic describes how you can determine if your User-Mode Driver Framework (UMDF) driver leaks (does not delete) framework objects. It applies only to UMDF versions 1.9 and 1.11.
Starting with UMDF version 2, you should instead use the Wdfkd.dll debugger extensions. For more info, see Windows Driver Framework Extensions (Wdfkd.dll).
To test if your driver leaks framework objects, use the following steps:
Use the WDF Verifier control application to set the verifier options that you want. During regular testing, start by setting TrackObjects and not TrackRefCounts.
When the driver is unloaded, the framework's code verifier enters the debugger if a framework object was not deleted, and it prompts you to use the !wudfdumpobjects debugger extension. This debugger extension displays a list of undeleted objects.
If the code verifier indicates that the driver is leaking framework objects, then use the control application to set the TrackRefCounts option.
If this option is set, the verifier keeps track of references to framework objects while the driver runs. You can use the !wudfrefhist debugger extension to display each call stack (set of function calls) that increments or decrements an object's reference count. By examining the AddRef and Release calls in these call stacks, you should be able to find a stack that does not decrement the object's reference count and thus causes the leak.
For information about additional verifier options, see UMDF Verifier Options.
For information about when to delete framework objects, see Managing the Lifetime of Objects.
Build date: 11/16/2013