Realloc

by 2 contributors:

« XPCOM API Reference

Summary

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

 static void* Realloc(
   void* aPtr,
   size_t aSize
 );

Parameters

aPtr
[in] The address of the memory block to reallocate. This may be nsnull, in which case Realloc behaves like nsMemory::Alloc.
aSize
[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.

Remarks

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

nsMemory::Free

Document Tags and Contributors

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