GetMemAllocAlignment

Gets the memory-allocation alignment size

Synopsis

int32 GetMemAllocAlignment( uint32 memflags )

Description

This function returns the alignment guaranteed by AllocMem() and friends, and required by FreeMem() and friends.

Arguments

memflags
Similar to the usage in GetPageSize(); different allocators may be in use for different kinds of memory, which may have different alignment guarantees and restrictions.

Return Value

The return value is the alignment modulus for the memory specified; for example, if AllocMem() guarantees (and FreeMem() requires) long-word alignment, it returns 4. If no alignment is guaranteed or required, it returns 1.

Implementation

Folio call implemented in kernel folio V22.

Associated Files

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

Caveat

Note that malloc() does not necessarily provide same alignment guarantee as AllocMem(), as malloc() reserves some space at the front of the block it gets from AllocMem() to contain the size of the block allocated.

See Also

GetMemType(), AllocMem(), FreeMem(), malloc(), free()