« XPCOM API Reference


The NS_GetMemoryManager function returns a reference to the XPCOM Memory Manager.

#include "nsXPCOM.h"
#include "nsIMemory.h"
nsresult NS_GetMemoryManager(
  nsIMemory** aResult


[out] A reference to the XPCOM Memory Manager.

Return Values

The NS_GetMemoryManager function returns NS_OK if successful. Otherwise, it returns an error code.


The object returned is a singleton that is valid until NS_ShutdownXPCOM is called. The interface pointer should be Release'd when it is no longer needed.

Any code, intended to be used exclusively with Mozilla 1.8 and above, may use NS_Alloc, NS_Realloc, and NS_Free instead to access the XPCOM Memory Manager's methods.


This function was finalized for Mozilla 0.9.7. See bug 112262 for details.

See Also

nsIMemory, NS_Alloc

Document Tags and Contributors

 Contributors to this page: Sheppy, DarinFisher, Nickolay
 Last updated by: Sheppy,