INtime SDK Help
mpool_alloc_alignedex
INtime SDK v7.2 > About INtime > Other system libraries > Heaps and memory pools > Memory pools > mpool_alloc_alignedex

Allocates a memory block of the specified size from a memory pool, aligned to the specified boundary. Unlike mpool_alloc_aligned, the returned pointer can be freed directly via mpool_free — no separate base pointer is needed.

void * mpool_alloc_alignedex(
    MPOOL pool, 
    DWORD size,
    DWORD align
);

Parameters

pool
The memory pool created by mpool_create.
size
The requested buffer's size. This value must be less than LONG_MAX. If the value of size is 0 (zero), a valid pointer returns, but the size of the actual buffer is 16. Any value less than 16 returns a buffer of size 16. Must be a power of two.
align
The maximum supported alignment is 1 MB (1,048,576 bytes). For alignments of 16 bytes or less, the call is automatically satisfied by the standard mpool_alloc path. Always examine the return from mpool_alloc_alignedex, even if the amount of memory requested is small.

Return Values

Success:

A pointer to the allocated space, aligned to the specified boundary. To get a pointer to a type other than void, use a type cast on the return value.

Failure:

NULL
The function sets errno to one of these values:
E2BIG The size is too large.
ENOSPC Out of virtual memory.
EEXIST The pool is deleted.
EINVAL The pool is not a valid MPOOL.
ENOMEM Out of physical memory.
Note: mpool_alloc_alignedex returns NULL and sets errno to EINVAL if pool is not a valid pool handle, if align is not a power of two, if align exceeds 1 MB, if size is not a multiple of align, or if size is zero. errno is set to ENOMEM if the pool does not have sufficient free space to satisfy the request.

Requirements

Versions Defined in Include Link to
INtime 7.3 intime/clib/include/mpool.h mpool.h clib.lib
   
See Also