#include <mempool.h>

Public Member Functions | |
| mempool (int is, int bs=MP_BLOCK_SIZE) | |
| Creates a memory pool. | |
| ~mempool () | |
| Destroys memory pool. | |
| void | map (std::ostream &co) |
| Prints a map of memory occupancy. | |
| char * | allocate () |
| Allocates a single memory entry. | |
| int | free (char *addr) |
| Frees a single memory entry. | |
| void | stat () |
| Prints statistics about this mempool. | |
| int | used () |
| Returns effectively used memory (bytes). | |
| int | wasted () |
| Returns amount of wasted memory (bytes). | |
A memory pool is composed of:
Definition at line 61 of file mempool.h.
| mempool::mempool | ( | int | is, | |
| int | bs = MP_BLOCK_SIZE | |||
| ) |
Creates a memory pool.
The pool contains:
Definition at line 46 of file mempool.cpp.
References NULL.
| mempool::~mempool | ( | ) |
| char * mempool::allocate | ( | ) |
Allocates a single memory entry.
Definition at line 87 of file mempool.cpp.
References NULL.
Referenced by ngramcache::add(), storage::allocate(), htable< T >::insert(), and storage::reallocate().

| int mempool::free | ( | char * | addr | ) |
Frees a single memory entry.
Definition at line 132 of file mempool.cpp.
Referenced by storage::free(), and storage::reallocate().

| void mempool::map | ( | std::ostream & | co | ) |
Prints a map of memory occupancy.
| void mempool::stat | ( | ) |
Prints statistics about this mempool.
Definition at line 205 of file mempool.cpp.
References VERBOSE.
| int mempool::used | ( | ) | [inline] |
Returns effectively used memory (bytes).
includes 8 bytes required by each call of new
Definition at line 93 of file mempool.h.
Referenced by ngramcache::stat(), storage::stat(), htable< int * >::used(), and wasted().

| int mempool::wasted | ( | ) | [inline] |
Returns amount of wasted memory (bytes).
Definition at line 98 of file mempool.h.
References used().
Referenced by ngramcache::stat(), and storage::stat().


1.5.9