Determining Why a UMDF Driver Consumes an Excessive Amount of Memory
Warning
UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2.
The archived UMDF 1 samples can be found in the Windows 11, version 22H2 - May 2022 Driver Samples Update.
For more info, see Getting Started with UMDF.
This topic describes how you can use the Wudfext.dll debugger extensions in conjunction with a User-Mode Driver Framework (UMDF) version 1 driver to determine why a UMDF driver consumes an excessive amount of memory.
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 investigate memory usage, use the following steps:
View the outstanding object in the object tree by using the !wudfext.wudfobject UMDF debugger extension.
The !wudfext.wudfobject extension displays information about a WDF object, which includes its parent and child relationships. If you set bit 0 of the Flags parameter to 1 (0x01), !wudfext.wudfobject performs a recursive dump of the object tree that is rooted at the object that you passed. To view the complete object tree, use the following example command:
!wudfext.wudfobject <IWDFDriver*> 1
Determine if you see more outstanding objects than you expect.
Your driver might eventually leak these objects (for more information about leaking WDF objects, see Determining If a Driver Leaks Framework Objects).
These objects might be in the object tree and would therefore eventually be freed. However, they are being accumulated unnecessarily. These objects might require:
- Corrections to their parent objects.
- Explicit deletion by using the IWDFObject::DeleteWdfObject method.