Determining If a Driver Leaks Framework Objects
If your driver uses version 1.9 or a later version of the framework, you can use the following steps to determine if your driver leaks (does not delete) framework objects:
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: 4/1/2013