NdisFreeMemory function

The NdisFreeMemory function releases a block of memory that was previously allocated with the NdisAllocateMemoryWithTagPriority function.

Syntax

void NdisFreeMemory(
  PVOID VirtualAddress,
  UINT  Length,
  UINT  MemoryFlags
);

Parameters

VirtualAddress

A pointer to the base virtual address of the allocated memory. This address was returned by the NdisAllocateMemoryWithTagPriority function.

Length

The size, in bytes, of the memory block to be released. If the memory was allocated with NdisAllocateMemoryWithTagPriority or the MemoryFlags parameter is zero, this parameter is ignored.

MemoryFlags

A set of flags that specify the type of memory to free. This value must be zero if the memory was allocated with NdisAllocateMemoryWithTagPriority. With NDIS 6.0 and later versions, the NdisAllocateMemoryWithTagPriority is always used to allocate memory.

Return Value

None

Remarks

Because noncached memory and contiguous memory are seldom released until the allocating miniport driver is unloading, a caller of NdisFreeMemory usually is running at IRQL = PASSIVE_LEVEL for these types of deallocations. In any case:

  • When releasing contiguous memory, a caller of NdisFreeMemory must be running at IRQL = PASSIVE_LEVEL.
  • When releasing noncached memory, a caller of NdisFreeMemory must be running at IRQL < DISPATCH_LEVEL.
  • When releasing memory that is neither contiguous nor noncached, a caller of NdisFreeMemory must be running at IRQL <= DISPATCH_LEVEL.

Requirements

   
Minimum supported client Supported for NDIS 6.0 and NDIS 5.1 drivers (see NdisFreeMemory (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see NdisFreeMemory (NDIS 5.1)) in Windows XP.
Target Platform Universal
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL See Remarks section
DDI compliance rules Irql_Miscellaneous_Function, NdisQueryBindInstanceName

See Also

MiniportHaltEx

NdisAllocateMemoryWithTagPriority