« XPCOM API Reference


The Realloc function reallocates a block of memory to a new size.

 static void* Realloc(
   void* aPtr,
   size_t aSize


[in] The address of the memory block to reallocate. This may be nsnull, in which case Realloc behaves like nsMemory::Alloc.
[in] Specifies the new size in bytes of the block of memory to allocate. This may be 0, in which case Realloc behaves like nsMemory::Free.

Return Values

This function returns nsnull if the memory allocation fails. Otherwise, it returns a pointer to the newly allocated buffer. The result must be freed with a call to nsMemory::Free when it is no longer needed.


If aPtr is non-null, then its contents will be unchanged to the minimum of the old and new sizes. Newly allocated memory is uninitialized.

See Also


Document Tags and Contributors

Contributors to this page: wbamberg, Sheppy, Pmash
Last updated by: wbamberg,