Facebook Twitter YouTube

class Memory

Defined in:  TSMemory.h
The Memory class template is used to cause objects to be allocated in a dedicated heap.
Definition

template <class type> class Memory

Template Parameters
type The type of object with which the dedicated heap is associated.
Constructor

Memory();

Description
The Memory class template is used as a base class for objects that are to be allocated in a dedicated heap. As an example, if all instances of a class Foo should be allocated in a dedicated heap for that class, then Foo should inherit from Memory<Foo> as follows.
class Foo : public Memory<Foo>
This causes instances of the class Foo to be allocated in the heap associated with the Memory<Foo> base class whenever the new operator is used to create them. The heap itself needs to be defined in the program as follows.
template <> Heap Tombstone::Memory<Foo>::heap("HeapName", poolSize, flags);
(See the constructor for the Heap class.)
See Also

Heap