|
Macaulay2 Engine
|
Slab allocator handing out fixed-size blocks for one BIBasis type per instance. More...
#include <allocator.hpp>
Public Member Functions | |
| FastAllocator (const size_t blockSize) | |
| ~FastAllocator () | |
| void * | Allocate () |
| void | Free (void *pointer) |
Private Member Functions | |
| void | ExpandMemory () |
Private Attributes | |
| const size_t | MemoryPageSize |
| const size_t | TSize |
| const size_t | PageSize |
| void ** | FreeBlock |
Slab allocator handing out fixed-size blocks for one BIBasis type per instance.
Allocates MemoryPageSize-byte pages from the system heap and carves each page into TSize-byte cells (typically the size of one VarsListNode or MonomDL etc.). Free cells are threaded into a FreeBlock LIFO so Allocate() / Free(p) are O(1) and avoid hitting malloc on the BIBasis inner loop. ExpandMemory() grabs a fresh page when the free list is empty.
Definition at line 56 of file allocator.hpp.