Macros for defining objects with "recycled memory"


o DEFINE_ALLOCATION_LIST
Macro for recycled memory; used in a class's constructor
o DEFINE_ALLOCATION_OPERATORS
Macro for recycled memory; used in a source file
Many types of small data structures are characterized by high allocation and deallocation rates. For these objects, using the normal memory allocation mechanisms can result in a significant performance hit while simultaneously increasing memory fragmentation. To overcome these problems, two macros are provided which will save deallocated objects in a linked list so that they can be re-used without having to actually reallocate memory via malloc() and friends. malloc() is only called when the list of previously freed objects is empty. When defining a new class that uses recycled memory, there are 3 simple steps:

To really deallocate the memory currently used in the list of freed objects, call [classname]::deleteFreeList().

Alphabetic index Hierarchy of classes



This page was generated with the help of DOC++.