NdisFreeMemory function

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

Syntax


VOID NdisFreeMemory(
  _In_ PVOID VirtualAddress,
  _In_ UINT  Length,
  _In_ UINT  MemoryFlags
);

Parameters

VirtualAddress [in]

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

Length [in]

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 [in]

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

Target platform

Universal

Version

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.

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

See Remarks section

DDI compliance rules

Irql_Miscellaneous_Function, NdisQueryBindInstanceName

See also

MiniportHaltEx
NdisAllocateMemoryWithTagPriority

 

 

Send comments about this topic to Microsoft

Show: