Gröbner basis project
Codebase for research into Gröbner basis computation
Memory Management

Classes and other structures related to memory management. More...

Classes

union  goda_block< TYPE >
 heart of the memory pool allocator (Grading_Order_Data_Allocator) More...
 
class  Grading_Order_Data_Allocator< TYPE >
 special memory pool allocator for Grevlex_Order_Data and WGrevlex_Order_Data More...
 

Variables

Grading_Order_Data_Allocator< DEG_TYPE > * doda = nullptr
 memory manager for ray entries More...
 
Grading_Order_Data_Allocator< WT_TYPE > * goda = nullptr
 Memory manager for graded ordering data. More...
 
Grading_Order_Data_Allocator< EXP_TYPE > * moda = nullptr
 memory manager for monomial exponents More...
 
Grading_Order_Data_Allocator< Monomial > * monoda = nullptr
 memory manager for monomials (not their exponents; see moda for that). More...
 
Grading_Order_Data_Allocator< Monomial_Node > * monododa = nullptr
 memory manager for Monomial_Node More...
 
Grading_Order_Data_Allocator< WGrevlex_Order_Data > * woda = nullptr
 Memory manager for graded orderings (not their data; see goda for that). More...
 

Detailed Description

Classes and other structures related to memory management.

These classes create memory pools that allocate large blocks of memory, each of which contains an enormous number of subblocks that can be obtained and released in \(O(1)\) time (or at least much more efficiently than new() and delete()).


Class Documentation

◆ goda_block

union goda_block

template<typename TYPE>
union goda_block< TYPE >

heart of the memory pool allocator (Grading_Order_Data_Allocator)

Author
John Perry
Date
2016

Definition at line 45 of file goda.hpp.

Class Members
TYPE * data the data contained in this block
goda_block * next pointer to the next free block

◆ Grading_Order_Data_Allocator

class Grading_Order_Data_Allocator

template<typename TYPE>
class Grading_Order_Data_Allocator< TYPE >

special memory pool allocator for Grevlex_Order_Data and WGrevlex_Order_Data

Author
John Perry
Date
2016

This is a quick-n-dirty memory pool allocator for Grevlex_Order_Data and WGrevlex_Order_Data. It isn't quite \(O(1)\) but the plan is to fix that eventually (I have to locate my notes from class).

Warning
This is initialized to a certain number of variables, which cannot change. If you want to do this for a different number of variables, create another allocator.
Examples:
test_dynamic.cpp.

Definition at line 67 of file goda.hpp.

Public Member Functions

 Grading_Order_Data_Allocator (NVAR_TYPE n)
 sets allocator up for blocks of \(n\) of type TYPE. More...
 
 ~Grading_Order_Data_Allocator ()
 releases all memory — you'd better have freed yours!
 
goda_block< TYPE > * allocate_new_block ()
 allocates a new superblock of almost 10000 blocks More...
 
TYPE * get_new_block ()
 allocates and returns a block of memory More...
 
void return_used_block (TYPE *freed_block)
 returns a block of memory that is no longer needed to the pool More...
 

Protected Attributes

goda_block< TYPE > * big_blocks
 pointer to the superblock of all blocks
 
goda_block< TYPE > * block
 pointer to the next free block
 
const unsigned data_size
 how many words to step from one block to the next
 

Constructor & Destructor Documentation

◆ Grading_Order_Data_Allocator()

template<typename TYPE>
Grading_Order_Data_Allocator< TYPE >::Grading_Order_Data_Allocator ( NVAR_TYPE  n)
inline

sets allocator up for blocks of \(n\) of type TYPE.

Parameters
nnumber of objects of type TYPE that should be allocated initially

The Grading_Order_Data_Allocator can and will allocate new blocks of n objects when it runs out of room.

Definition at line 90 of file goda.hpp.

Member Function Documentation

◆ allocate_new_block()

template<typename TYPE>
goda_block<TYPE>* Grading_Order_Data_Allocator< TYPE >::allocate_new_block ( )
inline

allocates a new superblock of almost 10000 blocks

Returns
the superblock

Definition at line 73 of file goda.hpp.

◆ get_new_block()

template<typename TYPE>
TYPE* Grading_Order_Data_Allocator< TYPE >::get_new_block ( )
inline

allocates and returns a block of memory

Returns
block of memory of the size specified in constructor

Definition at line 108 of file goda.hpp.

◆ return_used_block()

template<typename TYPE>
void Grading_Order_Data_Allocator< TYPE >::return_used_block ( TYPE *  freed_block)
inline

returns a block of memory that is no longer needed to the pool

Parameters
freed_blockblock to return to the pool

Definition at line 121 of file goda.hpp.

Variable Documentation

◆ doda

Grading_Order_Data_Allocator<DEG_TYPE>* doda = nullptr

memory manager for ray entries

Automatically initialized, but clients need to call the destructor when finished.

Definition at line 122 of file lp_solver.cpp.

◆ goda

Grading_Order_Data_Allocator<WT_TYPE>* goda = nullptr

Memory manager for graded ordering data.

Automatically initialized, but clients need to call the destructor when finished.

Definition at line 34 of file particular_orderings.cpp.

◆ moda

Grading_Order_Data_Allocator<EXP_TYPE>* moda = nullptr

memory manager for monomial exponents

Automatically initialized, but clients need to call the destructor when finished.

Definition at line 46 of file monomial.cpp.

◆ monoda

memory manager for monomials (not their exponents; see moda for that).

Automatically initialized, but clients need to call the destructor when finished.

Definition at line 53 of file monomial.cpp.

◆ monododa

memory manager for Monomial_Node

Automatically initialized, but clients need to call the destructor when finished.

Definition at line 29 of file polynomial_linked_list.cpp.

◆ woda

Memory manager for graded orderings (not their data; see goda for that).

Automatically initialized, but clients need to call the destructor when finished.

Definition at line 42 of file particular_orderings.cpp.