BAM
Abstract Machine for Bottom-Up Evaluation with the Push Method
|
#include <mpool.h>
Public Member Functions | |
mpool_c (str_t name) | |
page_t | alloc_page () |
mpool_c * | next_pool () const |
str_t | name () const |
int | num_alloc_pages () const |
void | dump (str_t headline=STR_NULL) const |
Static Public Member Functions | |
static mpool_c * | first_pool () |
Memory pool: Keeps track of allocated memory pages.
The main function of a memory pool is that it permits to allocate memory pages. It keeps track of the allocated memory pages. These memory pages will be deallocated in the destructor.
A memory pool is typically used in relation data structures and other data structures which need memory pages. If there is a local variable of the relation type in the program, and this is destroyed because the function returns, then all memory pages allocated by the relation will be automatically freed.
This class also manages a linked list of all existing objects (memory pools). This can be used for printing memory statistics. Therefore, it is necessary that memory pools have names (typically the name of the relation).