mariadb/newbrt/memory.h
Bradley C. Kuszmaul 3bba4f46d9 Make a malloc that reuses things (if you tell it the size of the free'd thing)
git-svn-id: file:///svn/tokudb@94 c7de825b-a66e-492c-adef-691d508d4ae1
2007-08-07 23:38:05 +00:00

27 lines
865 B
C

//#include <stdlib.h>
/* errno is set to 0 or a value to indicate problems. */
void *toku_calloc(long nmemb, long size);
void *toku_malloc(unsigned long size);
void *tagmalloc(unsigned long size, int typ);
void toku_free(void*);
void toku_free_n(void*, unsigned long size);
void *toku_realloc(void *, long size);
#define MALLOC(v) v = toku_malloc(sizeof(*v))
#define MALLOC_N(n,v) v = toku_malloc((n)*sizeof(*v))
#define TAGMALLOC(t,v) t v = tagmalloc(sizeof(*v), TYP_ ## t);
void *memdup (const void *v, unsigned int len);
char *toku_strdup (const char *s);
void memory_check_all_free (void);
void do_memory_check(void);
extern int memory_check; // Set to nonzero to get a (much) slower version of malloc that does (much) more checking.
int get_n_items_malloced(void);
void print_malloced_items(void);
void malloc_report (void);
void malloc_cleanup (void);