Condividi tramite


_aligned_msize_dbg

Returns the size of a memory block allocated in the heap (debug version only).

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

Parameters

  • [in] memblock
    Pointer to the memory block.

  • [in] alignment
    The alignment value, which must be an integer power of 2.

  • [in] offset
    The offset into the memory allocation to force the alignment.

Return Value

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

Remarks

The alignment and offset values must be the same as the values passed to the function that allocated the block.

_aligned_msize_dbg is a debug version of the _aligned_msize function. When _DEBUG is not defined, each call to _aligned_msize_dbg is reduced to a call to _aligned_msize. Both _aligned_msize and _aligned_msize_dbg calculate the size of a memory block in the base heap, but _aligned_msize_dbg adds a debugging feature: It includes the buffers on either side of the user portion of the memory block in the returned size.

This function validates its parameter. If memblock is a null pointer or alignment is not a power of 2, _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.

For information about how memory blocks are allocated, initialized, and managed in the debug version of the base heap, see Memory Management and the Debug Heap. For information about the allocation block types and how they are used, see Types of Blocks on the Debug Heap. For information about the differences between calling a standard heap function and its debug version in a debug build of an application, see Using the Debug Version Versus the Base Version.

Requirements

Routine

Required header

_aligned_msize_dbg

<crtdbg.h>

For more compatibility information, see Compatibility in the Introduction.

Libraries

Debug versions of C run-time libraries only.

.NET Framework Equivalent

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

See Also

Concepts

Memory Allocation