# Function Reference

# _WinAPI_CoTaskMemRealloc

Changes the size of a previously allocated block of task memory

#include <WinAPICom.au3>
_WinAPI_CoTaskMemRealloc ( $pMemory, $iSize )

## Parameters

$pMemory | The pointer to the memory block to be reallocated.
$iSize | The size of the memory block to be reallocated, in bytes.

## Return Value

Success: | The reallocated memory block.
Failure: | 0.

## Remarks

If $pMemory is 0, function allocates a new memory block in the same way as the _WinAPI_CoTaskMemAlloc() function.
If $pMemory is not 0, it should be a pointer returned by a prior call to _WinAPI_CoTaskMemAlloc().
The contents of the block are unchanged up to the shorter of the new and old sizes, although the new block can be in a different location.
If $pMemory is not 0 and $iSize is 0, then the memory pointed to by $pMemory is freed.

## See Also

Search CoTaskMemRealloc in MSDN Library.