CoGetMalloc

Retrieves a pointer to the default OLE task memory allocator (which supports the system implementation of the IMalloc interface) so applications can call its methods to manage memory.

HRESULT CoGetMalloc(

DWORD dwMemContext,

//Indicates if memory is private or shared

LPMALLOC * ppMalloc

//Indirect pointer to memory allocator

);

Parameters

dwMemContext
[in] Reserved; value must be 1.
ppMalloc
[out] Indirect pointer to an IMalloc interface on the memory allocator.

Return Values

This function supports the standard return values E_INVALIDARG and E_OUTOFMEMORY, as well as the following:

S_OK
Indicates the allocator was retrieved successfully.

Remarks

The pointer to the IMalloc interface pointer received through the ppMalloc parameter cannot be used from a remote process&emdash;each process must have its own allocator.

See Also

IMalloc, CoTaskMemAlloc