SophiaFramework UNIVERSE 5.3 |
Heap class is the class that encapsulate the MALLOC and FREE functions.
There are the SFXHeap class and the SFXClusterHeap class that supports block allocation.
These classes subsitute the MALLOC (SFXHelper::malloc), REALLOC (SFXHelper::realloc), and FREE ( SFXHelper::free) functions.
Example 14.1. Define the heap
// heap class used as array of SInt16 type. SFXHeap<SInt16> heap; // to use block allocation, write: SFXClusterHeap<SInt16> heap; // how to use SFXClusterHeap is similar to SFXHeap
Example 14.2. Allocate the Heap
// reserve 256-byte of heap like MALLOC (MemoryAllocate) function
heap.Resize(sizeof(SInt16) * 128);
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |