Alloc

« XPCOM API Reference

Summary

The Alloc function allocates a block of memory of a particular size.

 static void* Alloc(
   size_t aSize
 );

Parameters

aSize
[in] Specifies the size in bytes of the block of memory to allocate.

Return Values

This function is Infallible, therefore guaranteed to return a pointer to the newly allocated buffer. The result must be freed with a call to nsMemory::Free() when it is no longer needed.

Note: Prior to Gecko 13.0, this function returned nsnull if memory allocation failed.

See also

nsMemory::Free()