Macaulay2 Engine
Loading...
Searching...
No Matches

◆ ExpandMemory()

void BIBasis::FastAllocator::ExpandMemory ( )
private

Definition at line 34 of file allocator.cpp.

35 {
36 void **begin = static_cast<void**>(malloc(MemoryPageSize)),
37 **end = begin + TSize * (PageSize - 1),
38 **tmp;
39
40 if (!begin)
41 {
42 throw std::string("BIB::FastAllocator::ExpandMemory(): failed to allocate memory.");
43 }
44
45 *(reinterpret_cast<void***>(end)) = FreeBlock;
46 FreeBlock = static_cast<void**>(begin);
47 do
48 {
49 tmp = begin + TSize;
50 *(reinterpret_cast<void***>(begin)) = tmp;
51 begin = tmp;
52 } while(begin < end);
53 }
const size_t MemoryPageSize
Definition allocator.hpp:59
const size_t PageSize
Definition allocator.hpp:61
TermIterator< Nterm > begin(Nterm *ptr)
Definition ringelem.cpp:4
TermIterator< Nterm > end(Nterm *)
Definition ringelem.cpp:5

References begin(), end(), FreeBlock, MemoryPageSize, PageSize, and TSize.

Referenced by Allocate().