Bewerken

Share via


_aligned_msize

Returns the size of a memory block allocated in the heap.

Syntax

size_t _aligned_msize(
   void *memblock,
   size_t alignment,
   size_t offset
);

Parameters

memblock
Pointer to the memory block.

alignment
The alignment value, which must be an integer power of 2.

offset
The offset into the memory allocation to force the alignment.

Return value

Returns the size (in bytes) as an unsigned integer.

Remarks

The _aligned_msize function returns the size, in bytes, of the memory block allocated by a call to _aligned_malloc or _aligned_realloc. The alignment and offset values must be the same as the values passed to the function that allocated the block.

When the application is linked with a debug version of the C run-time libraries, _aligned_msize resolves to _aligned_msize_dbg. For more information about how the heap is managed during the debugging process, see The CRT debug heap.

This function validates its parameter. If memblock is a null pointer or alignment isn't a power of 2, _aligned_msize invokes an invalid parameter handler, as described in Parameter validation. If the error is handled, the function sets errno to EINVAL and returns -1.

By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.

Requirements

Routine Required header
_aligned_msize <malloc.h>

For more compatibility information, see Compatibility.

Libraries

All versions of the C run-time libraries.

See also

Memory allocation