env_alloc.h File Reference

#include "Envision/env_types.h"
Include dependency graph for env_alloc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  env_alloc_stats

Defines

#define ENV_NCACHE   ((env_size_t)32)

Typedefs

typedef void *( env_alloc_func )(env_size_t)
typedef void( env_dealloc_func )(void *)
typedef void( env_alloc_mutex_func )(void *)

Functions

void * env_allocate (env_size_t nbytes)
 Allocate nbytes of memory, throwing an exception in case of failure.
void env_deallocate (void *mem)
 Deallocate the given memory region.
void env_allocation_get_stats (struct env_alloc_stats *stats)
 Get current memory allocator stats.
void env_allocation_init (env_alloc_func *alloc_func, env_dealloc_func *dealloc_func)
 Initialize memory allocator.
void env_allocation_cleanup (void)
 Release any cached memory blocks.
void env_allocation_init_mutex_funcs (void *userdata, env_alloc_mutex_func *mutex_acquire, env_alloc_mutex_func *mutex_release)
 Install callbacks to provide thread-safety if desired.

Detailed Description

memory allocation routines for 16-byte alignment

Definition in file env_alloc.h.


Function Documentation

void* env_allocate ( env_size_t  nbytes  ) 

Allocate nbytes of memory, throwing an exception in case of failure.

Definition at line 345 of file env_alloc.c.

Referenced by env_mt_chan_orientation(), env_mt_motion_channel_input_and_consume_pyr(), env_pyr_init(), and env_stdio_parse_rgb().

void env_allocation_cleanup ( void   ) 

Release any cached memory blocks.

Definition at line 386 of file env_alloc.c.

Referenced by EnvVisualCortexBase::~EnvVisualCortexBase().

void env_allocation_get_stats ( struct env_alloc_stats stats  ) 

Get current memory allocator stats.

Definition at line 365 of file env_alloc.c.

Referenced by EnvVisualCortexBase::stop2().

void env_allocation_init ( env_alloc_func *  alloc_func,
env_dealloc_func *  dealloc_func 
)

Initialize memory allocator.

Parameters:
alloc_func pointer to some function that allocates raw memory (e.g. something that wraps malloc())
dealloc_func pointer to some function that deallocates raw memory (e.g. free())

Definition at line 373 of file env_alloc.c.

Referenced by EnvVisualCortexBase::start1().

void env_allocation_init_mutex_funcs ( void *  userdata,
env_alloc_mutex_func *  mutex_acquire,
env_alloc_mutex_func *  mutex_release 
)

Install callbacks to provide thread-safety if desired.

Parameters:
mutex_acquire this function will be called at the beginning of every env_allocate(), env_deallocate(), env_allocation_get_stats(), env_allocation_init(), and env_allocation_cleanup() call
mutex_release this function will be called at the end of every such call

It is not necessary to install any callbacks in a program where env_allocate() and env_deallocate() are always called from just a single thread; but any program that might use those functions concurrently from multiple threads must install mutex functions here.

Definition at line 394 of file env_alloc.c.

Referenced by env_init_pthread_alloc().

void env_deallocate ( void *  mem  ) 

Deallocate the given memory region.

Definition at line 354 of file env_alloc.c.

Referenced by env_mt_chan_orientation(), and env_mt_motion_channel_input_and_consume_pyr().

Generated on Sun May 8 08:11:51 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3