Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Memory Allocation Overview


Purpose

Provides low-level functionality by which an EPOC process can access and manipulate memory areas.

Most client programs do not need to use this functionality directly. They are used by programs that are explicitly concerned about sharing memory areas between threads within a process, or between processes.

[Top]


Description

The API has two key concepts: chunk and heap.


Chunk

A chunk is a region of RAM mapped into contiguous linear addresses. The address space of a process when it is created consists of one to three chunks:

The stack/heap chunk; this contains the stack and the heap used by the main thread of the process. This chunk always exists.

The code chunk: this exists only if the process is loaded into RAM (i.e. it is not ROM resident).

The data chunk: this exists only if the process has static data.

A program can create additional chunks. A global chunk can be accessed by other processes, and so allows large amounts of memory to be shared.

The chunk interface is provided by RChunk.

TFindChunk is used for finding a global chunk created by another process.


Heap

A heap is used for explicit dynamic allocation of memory. EPOC defines C++'s new operator to create objects on the current thread's heap.

Heaps may be:

The heap interface is provided by RHeap. Where the heap in question is the current thread's heap, it is more convenient to use the equivalent functions provided by the System Static Functions API User class.

The System Static Functions API also provides macros that conveniently wrap calls for monitoring heap usage for memory leaks.

[Top]


See also

Raw Memory Overview

System Static Functions Overview

Thread And Process Management Overview