storage Class Reference

Manages multiple memory pools. More...

#include <mempool.h>

Collaboration diagram for storage:

Collaboration graph
[legend]

List of all members.

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.


Detailed Description

Manages multiple memory pools.

This class permits to manage memory pools with items up to a specified size.

Definition at line 157 of file mempool.h.


Constructor & Destructor Documentation

storage::storage ( int  maxsize,
int  blocksize 
)

Creates storage.

Definition at line 389 of file mempool.cpp.

References NULL.

storage::~storage (  ) 

Destroys storage.

Definition at line 401 of file mempool.cpp.


Member Function Documentation

char * storage::allocate ( int  size  ) 

Allocates memory.

Definition at line 409 of file mempool.cpp.

References mempool::allocate(), and NULL.

Referenced by ngramtable::grow().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:

Generated on Thu Jul 6 00:32:01 2017 for Moses by  doxygen 1.5.9