Allocates memory with alignment on current memory's page size boundary.
Unit
Syntax
ParametersASize [in] Size of memory block to allocate in bytes.
AHolder [out] a pointer to backbone storage. This is the pointer which must be passed to FreeMem to release this memory block.
Return valueA pointer to memory block of ASize bytes aligned at page boundary.
Exceptions
RemarksThis function is the same as AllocMem except it also aligns result on memory's page size boundary.
That's it, if memory's page size is 4 Kb - then result is always aligned on 4 Kb (i.e. have 12 zeros at low part of pointer when represented in binary).
Thus, this function have an overhead of maximum 2 size of memory's page. For example, if memory's page size is 4 Kb - then this function will allocate 12 Kb for ASize less than 4 Kb, 16 Kb - for ASize less than 8 Kb and so on.
You shouldn't pass returned pointer to any memory releasing routines (like FreeMem). Instead, call FreeMem for AHolder.
See also
|