Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

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()

Document Tags and Contributors

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