0 out of 1 rated this helpful - Rate this topic

CoGetMalloc function

Applies to: desktop apps only

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.

Syntax

HRESULT CoGetMalloc(
  __in   DWORD dwMemContext,
  __out  LPMALLOC *ppMalloc
);

Parameters

dwMemContext [in]

This parameter must be 1.

ppMalloc [out]

The address of an IMalloc* pointer variable that receives the interface pointer to the memory allocator.

Return value

This function can return the standard return values S_OK, E_INVALIDARG, and E_OUTOFMEMORY.

Remarks

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

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Objbase.h

Library

Ole32.lib

DLL

Ole32.dll

See also

CoTaskMemAlloc
IMalloc

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
C# syntax
[DllImport("ole32.dll")]
public static extern int CoGetMalloc(int dwReserved, out IMalloc pMalloc);
vb.net syntax
<DllImport("ole32.dll")> _
Public Shared Function CoGetMalloc(ByVal dwReserved As Integer, <Out> ByRef pMalloc As IMalloc) As Integer End Function