This function releases a block of memory previously allocated with the NdisAllocateMemory function.

VOID NdisFreeMemory(
  PVOID VirtualAddress,
  UINT Length,
  UINT MemoryFlags


  • VirtualAddress
    [in] Pointer to the base virtual address of the allocated memory. This address was returned by the NdisAllocateMemory function.

  • Length
    [in] Specifies the size, in bytes, of the memory block to be released. This parameter must be identical to the Length that was passed to NdisAllocateMemory.

  • MemoryFlags
    [in] Specifies 0 or the bitmask originally passed to NdisAllocateMemory for the preceding range. The following table shows valid memory flag values.

    Value Description
    0 System-space memory.
    NDIS_MEMORY_NONCACHED Noncached memory.

    This value must be identical to the MemoryFlags parameter that was passed to NdisAllocateMemory.

Return Values



The parameters passed to this function must be identical to those passed to NdisAllocateMemory when the block of memory was allocated. That is, a caller of this function cannot release a sub-range of the block that was allocated.


OS Versions: Windows CE .NET 4.0 and later.
Header: Ndis.h.

See Also


 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.