Skip to content

Latest commit

 

History

History
140 lines (87 loc) · 3.84 KB

ccrtheap-class.md

File metadata and controls

140 lines (87 loc) · 3.84 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: CCRTHeap Class
CCRTHeap Class
11/04/2016
CCRTHeap
ATLMEM/ATL::CCRTHeap
ATLMEM/ATL::CCRTHeap::Allocate
ATLMEM/ATL::CCRTHeap::Free
ATLMEM/ATL::CCRTHeap::GetSize
ATLMEM/ATL::CCRTHeap::Reallocate
CCRTHeap class
321bd6c5-1856-4ff7-8590-95044a1209f7

CCRTHeap Class

This class implements IAtlMemMgr using the CRT heap functions.

Syntax

class CCRTHeap : public IAtlMemMgr

Members

Public Methods

Name Description
CCRTHeap::Allocate Call this method to allocate a block of memory.
CCRTHeap::Free Call this method to free a block of memory allocated by this memory manager.
CCRTHeap::GetSize Call this method to get the allocated size of a memory block allocated by this memory manager.
CCRTHeap::Reallocate Call this method to reallocate memory allocated by this memory manager.

Remarks

CCRTHeap implements memory allocation functions using the CRT heap functions, including malloc, free, realloc, and _msize.

Example

See the example for IAtlMemMgr.

Inheritance Hierarchy

IAtlMemMgr

CCRTHeap

Requirements

Header: atlmem.h

CCRTHeap::Allocate

Call this method to allocate a block of memory.

virtual __declspec(allocator) void* Allocate(size_t nBytes) throw();

Parameters

nBytes
The requested number of bytes in the new memory block.

Return Value

Returns a pointer to the start of the newly allocated memory block.

Remarks

Call CCRTHeap::Free or CCRTHeap::Reallocate to free the memory allocated by this method.

Implemented using malloc.

CCRTHeap::Free

Call this method to free a block of memory allocated by this memory manager.

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

Parameters

p
Pointer to memory previously allocated by this memory manager. NULL is a valid value and does nothing.

Remarks

Implemented using free.

CCRTHeap::GetSize

Call this method to get the allocated size of a memory block allocated by this memory manager.

virtual size_t GetSize(void* p) throw();

Parameters

p
Pointer to memory previously allocated by this memory manager.

Return Value

Returns the size of the allocated memory block in bytes.

Remarks

Implemented using _msize.

CCRTHeap::Reallocate

Call this method to reallocate memory allocated by this memory manager.

virtual __declspec(allocator) void* Reallocate(void* p, size_t nBytes) throw();

Parameters

p
Pointer to memory previously allocated by this memory manager.

nBytes
The requested number of bytes in the new memory block.

Return Value

Returns a pointer to the start of the newly allocated memory block.

Remarks

Call CCRTHeap::Free to free the memory allocated by this method. Implemented using realloc.

See also

Class Overview
CComHeap Class
CWin32Heap Class
CLocalHeap Class
CGlobalHeap Class
IAtlMemMgr Class