Allocates memory on a specified alignment boundary.
void * _aligned_offset_malloc( size_t size, size_t alignment, size_t offset );
The size of the requested memory allocation.
The alignment value, which must be an integer power of 2.
The offset into the memory allocation to force the alignment.
A pointer to the memory block that was allocated or
NULL if the operation failed.
_aligned_offset_malloc is useful in situations where alignment is needed on a nested element; for example, if alignment was needed on a nested class.
_aligned_offset_malloc is based on
malloc; for more information, see
_aligned_offset_malloc is marked
__declspec(restrict), meaning that the function is guaranteed not to modify global variables and that the pointer returned isn't aliased. For more information, see
This function sets
ENOMEM if the memory allocation failed or if the requested size was greater than
_HEAP_MAXREQ. For more information about
_aligned_offset_malloc validates its parameters. If
alignment isn't a power of 2, or if
offset is non-zero and greater than or equal to
size, this function invokes the invalid parameter handler, as described in Parameter validation. If execution is allowed to continue, this function returns
NULL and sets
By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.
For more information, see