CComAllocator Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

This class provides methods for managing memory using COM memory routines.

class CComAllocator

Public Methods

NameDescription
CComAllocator::AllocateCall this static method to allocate memory.
CComAllocator::FreeCall this static method to free allocated memory.
CComAllocator::ReallocateCall this static method to reallocate memory.

This class is used by CComHeapPtr to provide the COM memory allocation routines. The counterpart class, CCRTAllocator, provides the same methods using CRT routines.

Header: atlbase.h

Call this static function to allocate memory.

static void* Allocate(size_t nBytes) throw();

Parameters

nBytes
The number of bytes to allocate.

Return Value

Returns a void pointer to the allocated space, or NULL if there is insufficient memory available.

Remarks

Allocates memory. See CoTaskMemAlloc for more details.

Call this static function to free allocated memory.

static void Free(void* p) throw();

Parameters

p
Pointer to the allocated memory.

Remarks

Frees the allocated memory. See CoTaskMemFree for more details.

Call this static function to reallocate memory.

static void* Reallocate(void* p, size_t nBytes) throw();

Parameters

p
Pointer to the allocated memory.

nBytes
The number of bytes to reallocate.

Return Value

Returns a void pointer to the allocated space, or NULL if there is insufficient memory

Remarks

Resizes the amount of allocated memory. See CoTaskMemRealloc for more details.

CComHeapPtr Class
CCRTAllocator Class
Class Overview

Show: