NXMemAlloc

Allocates an aligned block of memory.

Library:LibC
Classification:NKS
Service:Memory Management

Syntax

  #include <nks/memory.h>
   
  void *NXMemAlloc (
     size_t   size, 
     size_t   alignment);
  

Parameters

size

(IN) Specifies the size, in bytes, of the memory to allocate.

alignment

(IN) Specifies the alignment requirements, if any. Zero indicates a default alignment. If a nonzero alignment value is specified, it must be a power of two. If an illegal alignment is specified, the alignment reverts to default alignment.

Return Values

If successful, returns a pointer to the block of allocated memory; otherwise, returns NULL.

Remarks

The allocated memory might be pageable. For information concerning page sized allocations, refer to NXPageAlloc.

For sample code, see Memory.c.

See Also