33 static pthread_mutex_t nmem_mutex = PTHREAD_MUTEX_INITIALIZER;
39 #define NMEM_CHUNK (4*1024)
71 #define NMEM_ALIGN (offsetof(struct align, u))
79 pthread_mutex_lock(&nmem_mutex);
86 pthread_mutex_unlock(&nmem_mutex);
176 #if YAZ_POSIX_THREADS
231 size_t handles, blocks, allocated;
240 " <handles>%zd</handles>\n"
241 " <blocks>%zd</blocks>\n"
242 " <allocated>%zd</allocated>\n"
243 "</nmem>\n", handles, blocks, allocated);
Header for errno utilities.
void yaz_log(int level, const char *fmt,...)
Writes log message.
int yaz_log_module_level(const char *name)
returns level for module
#define YLOG_FATAL
log level: fatal
void nmem_init_globals(void)
void nmem_transfer(NMEM dst, NMEM src)
transfers memory from one NMEM handle to another
static void free_block(struct nmem_block *p)
static size_t no_nmem_blocks
static void nmem_lock(void)
static size_t nmem_allocated
static size_t no_nmem_handles
void nmem_reset(NMEM n)
releases memory associaged with an NMEM handle
int nmem_get_status(char *dst, size_t l)
returns memory status for NMEM - as XML
static void nmem_unlock(void)
NMEM nmem_create(void)
returns new NMEM handle
static struct nmem_block * get_block(size_t size)
void * nmem_malloc(NMEM n, size_t size)
allocates memory block on NMEM handle
size_t nmem_total(NMEM n)
returns size in bytes of memory for NMEM handle
static int log_level_initialized
void nmem_destroy(NMEM n)
destroys NMEM handle and memory associated with it
Header for Nibble Memory functions.
void yaz_snprintf(char *buf, size_t size, const char *fmt,...)
Header for config file reading utilities.
struct nmem_control * next
struct nmem_block * blocks
Header for memory handling functions.
#define xfree(x)
utility macro which calls xfree_f
#define xmalloc(x)
utility macro which calls malloc_f