FreeMemToMemList

Frees a private block of memory.

Synopsis

void FreeMemToMemList( MemList *ml, void *p, int32 size )

Description

This procedure frees a private block of memory that was previously allocated by a call to AllocMemFromMemList(). You can also use it to add memory to a private memory list created by AllocMemList().

Note: The memory you free to a memory list must be either memory that was previously allocated from the list or (when adding new memory to the list) memory of the type specified (by the p argument of AllocMemList()) when the memory list was created.

The block of memory is expected to begin and end on nicely aligned bounds; the alignment size can be obtained by calling GetMemAllocAlignment(). If the block is not properly aligned, the base is rounded up and the size is rounded down until alignment is achieved.

Arguments

ml
A pointer to the memory list to which to free the memory.
p
A pointer to the memory to free. This value may be NULL, in which case this function just returns.
size
The number of bytes to free. This must be the same size that was passed to AllocMemFromMemList() to allocate the block. See FreeMem for additional information.

Implementation

Folio call implemented in kernel folio V20.

Associated Files

mem.h
ANSI C Prototype
clib.lib
ARM Link Library

See Also

AllocMemFromMemList(), AllocMemList(), FreeMemList(), GetMemAllocAlignment()