Share via


_aligned_recalloc

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _aligned_recalloc.

Changes the size of a memory block that was allocated with _aligned_malloc or _aligned_offset_malloc and initializes the memory to 0.

Syntax

void * _aligned_recalloc(  
   void *memblock,   
   size_t num,  
   size_t size,   
   size_t alignment  
);  

Parameters

[in] memblock
The current memory block pointer.

[in] num
The number of elements.

[in] size
The size in bytes of each element.

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

Return Value

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

It is an error to reallocate memory and change the alignment of a block.

Remarks

_aligned_recalloc is based on malloc. For more information about using _aligned_offset_malloc, see malloc.

This function sets errno to ENOMEM if the memory allocation failed or if the requested size was greater than _HEAP_MAXREQ. For more information about errno, see errno, _doserrno, _sys_errlist, and _sys_nerr. Also, _aligned_recalloc validates its parameters. If alignment is not a power of 2, 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.

Requirements

Routine Required header
_aligned_recalloc <malloc.h>

.NET Framework Equivalent

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

See Also

Data Alignment
_recalloc
_aligned_offset_recalloc