Changes the size of a memory block that was allocated with _aligned_malloc or _aligned_offset_malloc and initializes the memory to 0 (debug version only).

void * _aligned_offset_recalloc_dbg(
   void *memblock, 
   size_t num, 
   size_t size, 
   size_t alignment,
   size_t offset,
   const char *filename,
   int linenumber

[in] memblock

The current memory block pointer.

[in] num

Number of elements.

[in] size

Length in bytes of each element.

[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.

[in] filename

Pointer to the name of the source file that requested the realloc operation or NULL.

[in] linenumber

Line number in the source file where the realloc operation was requested or NULL.

_aligned_offset_recalloc_dbg returns a void pointer to the reallocated (and possibly moved) memory block. The return value is NULL if the size is zero and the buffer argument is not NULL, or if there is not enough available memory to expand the block to the given size. In the first case, the original block is freed. In the second case, the original block is unchanged. The return value points to a storage space that is guaranteed to be suitably aligned for storage of any type of object. To get a pointer to a type other than void, use a type cast on the return value.

_aligned_offset_realloc_dbg is a debug version of the _aligned_offset_recalloc function. When _DEBUG is not defined, each call to _aligned_offset_recalloc_dbg is reduced to a call to _aligned_offset_recalloc. Both _aligned_offset_recalloc and _aligned_offset_recalloc_dbg reallocate a memory block in the base heap, but _aligned_offset_recalloc_dbg accommodates several debugging features: buffers on either side of the user portion of the block to test for leaks, a block type parameter to track specific allocation types, and filename/linenumber information to determine the origin of allocation requests.

_aligned_offset_realloc_dbg reallocates the specified memory block with slightly more space than the requested newSize. newSize might be greater or less than the size of the originally allocated memory block. The additional space is used by the debug heap manager to link the debug memory blocks and to provide the application with debug header information and overwrite buffers. The reallocation might result in moving the original memory block to a different location in the heap, as well as changing the size of the memory block. If the memory block is moved, the contents of the original block are overwritten.

In Visual C++ 2005, this function sets errno to ENOMEM if the memory allocation failed or if the requested size (num * size) was greater than _HEAP_MAXREQ. For more information about errno, see errno, _doserrno, _sys_errlist, and _sys_nerr. Also, _aligned_offset_recalloc_dbg validates its parameters. If alignment is not a power of 2 or if offset is greater than or equal to the requested size and nonzero, this function invokes the invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, this function returns NULL and sets errno to EINVAL.

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.


Required header



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

Adiciones de comunidad