Compartilhar via


CCRTAllocator Class

 

The latest version of this topic can be found at CCRTAllocator Class.

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

Syntax

class ATL::CCRTAllocator

Members

Public Methods

Name Description
CCRTAllocator::Allocate (Static) Call this method to allocate memory.
CCRTAllocator::Free (Static) Call this method to free memory.
CCRTAllocator::Reallocate (Static) Call this method to reallocate memory.

Remarks

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

Requirements

Header: atlcore.h

CCRTAllocator::Allocate

Call this static function to allocate memory.

static __declspec(allocator) 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 malloc for more details.

CCRTAllocator::Free

Call this static function to free memory.

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

Parameters

p
Pointer to the allocated memory.

Remarks

Frees the allocated memory. See free for more details.

CCRTAllocator::Reallocate

Call this static function to reallocate memory.

static __declspec(allocator) 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 realloc for more details.

See Also

CHeapPtr Class
CComAllocator Class
Class Overview