Memory Allocation

WDF drivers use and allocate memory as a general resource and in several specific ways:

  • For local storage

  • As WDF memory objects

This section provides basic information about allocating memory for local storage and about creating and allocating buffers and memory objects.

Local Storage

In some situations, a driver requires local storage that is not associated with an I/O request or that must be passed outside the framework to another component.

Depending on the type of required storage, UMDF drivers can use new, malloc, and other Windows user-mode and language-specific allocation techniques.

KMDF drivers use Windows kernel-mode DDIs, typically ExAllocatePoolWithTag, to allocate memory that is not part of a WDF memory object. For example, ...

Get Developing Drivers with the Windows® Driver Foundation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.