#include <mempool.h>
Public Member Functions | |
storage (int maxsize, int blocksize) | |
Creates storage. | |
~storage () | |
Destroys storage. | |
char * | allocate (int size) |
Allocates memory. | |
char * | reallocate (char *oldptr, int oldsize, int newsize) |
Realloc memory. | |
int | free (char *addr, int size=0) |
Frees memory of an entry. | |
void | stat () |
Prints statistics about storage. |
This class permits to manage memory pools with items up to a specified size.
Definition at line 157 of file mempool.h.
storage::storage | ( | int | maxsize, | |
int | blocksize | |||
) |
storage::~storage | ( | ) |
char * storage::allocate | ( | int | size | ) |
Allocates memory.
Definition at line 409 of file mempool.cpp.
References mempool::allocate(), and NULL.
Referenced by ngramtable::grow().
int storage::free | ( | char * | addr, | |
int | size = 0 | |||
) |
Frees memory of an entry.
Definition at line 465 of file mempool.cpp.
References mempool::free().
Referenced by ngramtable::freetree(), and ngramtable::grow().
char * storage::reallocate | ( | char * | oldptr, | |
int | oldsize, | |||
int | newsize | |||
) |
Realloc memory.
Definition at line 430 of file mempool.cpp.
References mempool::allocate(), mempool::free(), and NULL.
Referenced by ngramtable::grow().
void storage::stat | ( | ) |
Prints statistics about storage.
Definition at line 485 of file mempool.cpp.
References mempool::used(), VERBOSE, and mempool::wasted().
Referenced by ngramtable::stat().