CComAllocator Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CComAllocator Class.
This class provides methods for managing memory using COM memory routines.
class CComAllocator
Public Methods
| Name | Description |
|---|---|
| CComAllocator::Allocate | Call this static method to allocate memory. |
| CComAllocator::Free | Call this static method to free allocated memory. |
| CComAllocator::Reallocate | Call 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.