Visit Mozilla.org

nsMemory:Clone

From MDC

« XPCOM API Reference

Contents

[edit] Summary

The Clone function creates a copy of an existing memory block up to the size specified.

 static void* Clone(
   const void* aPtr,
   size_t aSize
 );

[edit] Parameters

aPtr
[in] The address of the memory block to copy. This must be non-null.
aSize
[in] Specifies the new size in bytes of the block of memory to allocate. The buffer at aPtr must be at least aSize bytes in length.

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

[edit] See Also

nsMemory::Free