« XPCOM API Reference


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

 static void* Alloc(
   size_t 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


Document Tags and Contributors

Contributors to this page: wbamberg, mdnwebdocs-bot, Sheppy, kscarfone, avih, Pmash
Last updated by: wbamberg,