SphinxBase  5prealpha
listelem_alloc.h File Reference

Fast memory allocator for uniformly sized objects. More...

#include <stdlib.h>
#include <sphinxbase/sphinxbase_export.h>
#include <sphinxbase/prim_type.h>

Go to the source code of this file.

Macros

#define listelem_malloc(le)   __listelem_malloc__((le),__FILE__,__LINE__)
 Allocate a list element and return pointer to it.
 
#define listelem_malloc_id(le, oid)   __listelem_malloc_id__((le),__FILE__,__LINE__,(oid))
 Allocate a list element, returning a unique identifier.
 
#define listelem_free(le, el)   __listelem_free__((le),(el),__FILE__,__LINE__)
 Macro of listelem_free
 

Typedefs

typedef struct listelem_alloc_s listelem_alloc_t
 List element allocator object.
 

Functions

SPHINXBASE_EXPORT
listelem_alloc_t
listelem_alloc_init (size_t elemsize)
 Initialize and return a list element allocator.
 
SPHINXBASE_EXPORT void listelem_alloc_free (listelem_alloc_t *le)
 Finalize and release all memory associated with a list element allocator.
 
SPHINXBASE_EXPORT void * __listelem_malloc__ (listelem_alloc_t *le, char *file, int line)
 
SPHINXBASE_EXPORT void * __listelem_malloc_id__ (listelem_alloc_t *le, char *file, int line, int32 *out_id)
 
SPHINXBASE_EXPORT void * listelem_get_item (listelem_alloc_t *le, int32 id)
 Retrieve a list element by its identifier.
 
SPHINXBASE_EXPORT void __listelem_free__ (listelem_alloc_t *le, void *elem, char *file, int line)
 Free list element of given size.
 
SPHINXBASE_EXPORT void listelem_stats (listelem_alloc_t *le)
 Print number of allocation, numer of free operation stats.
 

Detailed Description

Fast memory allocator for uniformly sized objects.

Author
M K Ravishankar rkm@c.nosp@m.s.cm.nosp@m.u.edu

Definition in file listelem_alloc.h.