Memory pool manager for efficient instance allocation. More...
#include <pool.hpp>
Public Member Functions | |
| chunks * | get (const instance &it) |
| Gets chunks container managing memory for given instance. | |
| chunks * | get (const instance *it) BY_SIDE_FUNC(get) |
| chunks * | get (nidx n) |
| Gets chunks at specified index. | |
| ncnt | size () const override |
| ncnt | len () const override |
| nbool | rel () override |
| Releases all pool resources and destroys chunks. | |
Public Member Functions inherited from by::memoryHaver | |
| virtual nbool | has (const instance &it) const =0 |
| Checks if this memory manager "owns" or contains the given instance. | |
| nbool | has (const instance *it) const BY_SIDE_FUNC(has) |
| nbool | isFull () const |
| nbool | isCapable () const |
Public Attributes | |
| const chunks *get(const instance &it) const BY_CONST_FUNC(get(it)) const chunks *get(const instance *it) const BY_CONST_FUNC(get(it)) const chunks *get(nidx n) const BY_CONST_FUNC(get(n)) using super nboo | has )(const instance &it) const override |
| Checks if instance is managed by this pool. | |
Protected Member Functions | |
| void * | _get (nidx n) override |
| Gets raw memory pointer at index. | |
Memory pool manager for efficient instance allocation.
The first class to handle memory allocation requests from external sources. Internally has an array of chunks, and since chunks has chunk, effectively manages all low-level memory-related classes.
A key point in creating a custom memory pool is increasing speed by listing same-size memory in one place. chunks has a block concept where each block can only allocate/ deallocate pre-specified sized memory. pool creates chunks with fixed block size. When external requests memory allocation of a specific size, pool finds chunks handling that block size. If none exist, creates lazily.
Gets raw memory pointer at index.
Implements by::memoryHaver.
Gets chunks container managing memory for given instance.
Gets chunks at specified index.
|
overridevirtual |
Implements by::memoryHaver.
|
overridevirtual |
Releases all pool resources and destroys chunks.
Implements by::memoryHaver.
|
overridevirtual |
Implements by::memoryHaver.
|
override |
Checks if instance is managed by this pool.