#include "Util/AllocAux.H"
#include "Util/Assert.H"
#include "Util/log.H"
#include "Util/sformat.H"
#include "rutz/freelist.h"
#include "rutz/mutex.h"
#include "rutz/trace.h"
#include <map>
#include <pthread.h>
Go to the source code of this file.
Defines | |
#define | DO_ALIGN |
#define | DO_FASTCACHE |
#define | NALIGN ( (4*sizeof(void*)) > 16 ? (4*sizeof(void*)) : 16 ) |
#define | NCACHE 64 |
Functions | |
void * | invt_allocate_aux (size_t user_nbytes) |
Allocate nbytes of memory, throwing an exception in case of failure. | |
void | invt_deallocate_aux (void *mem) |
Deallocate the given memory region. | |
void | invt_allocation_release_free_mem () |
Released any cached free memory blocks (e.g. to conserve memory). | |
void | invt_allocation_allow_caching (bool on) |
Turn on/off caching of memory blocks of commonly-used sizes. | |
void | invt_allocation_debug_print (bool do_debug) |
Turn on/off memory-allocation debugging statements. | |
void | invt_allocation_show_stats (int verbosity, const char *pfx, const size_t block_size) |
Print current stats for whatever memory allocator is in use. | |
void | invt_allocation_set_stats_units (const size_t units) |
Set the units to be used by default in invt_allocation_show_stats(). |
memory allocation routines for 16-byte alignment
Definition in file AllocAux.C.
void* invt_allocate_aux | ( | size_t | user_nbytes | ) |
Allocate nbytes of memory, throwing an exception in case of failure.
Definition at line 515 of file AllocAux.C.
Referenced by invt_allocate().
void invt_allocation_allow_caching | ( | bool | on | ) |
Turn on/off caching of memory blocks of commonly-used sizes.
Definition at line 533 of file AllocAux.C.
Referenced by ModelManager::paramChanged().
void invt_allocation_debug_print | ( | bool | ) |
Turn on/off memory-allocation debugging statements.
If on, each invt_allocate() and invt_deallocate() call will print some stats about the memory block being currently allocated/deallocated, as well as some general stats about the total amount of memory allocated and the amount of memory currently in use
Definition at line 539 of file AllocAux.C.
void invt_allocation_release_free_mem | ( | ) |
Released any cached free memory blocks (e.g. to conserve memory).
Definition at line 527 of file AllocAux.C.
Referenced by TrainingSet::load(), and TrainingSet::loadRebalanced().
void invt_allocation_set_stats_units | ( | const size_t | units | ) |
Set the units to be used by default in invt_allocation_show_stats().
Definition at line 553 of file AllocAux.C.
void invt_allocation_show_stats | ( | int | verbosity = 0 , |
|
const char * | pfx = 0 , |
|||
const size_t | units = 0 | |||
) |
Print current stats for whatever memory allocator is in use.
verbosity | If greater than 0, will request additional stats to be displayed | |
pfx | If non-null, will be printed at the beginning of each stats line. | |
units | If non-zero, allocated memory blocks will be listed as multiples of this number of bytes; otherwise memory blocks will be listed as multiples of the units specified in the most recent call to invt_allocation_set_stats_units(). |
Definition at line 545 of file AllocAux.C.
Referenced by EnvVisualCortexBase::stop2(), and submain().
void invt_deallocate_aux | ( | void * | mem | ) |
Deallocate the given memory region.
Definition at line 521 of file AllocAux.C.
Referenced by invt_deallocate().