BRL-CAD
malloc.h File Reference
#include "common.h"
#include <stddef.h>
#include "bu/defines.h"
#include "bu/magic.h"
Include dependency graph for malloc.h:

Go to the source code of this file.

Macros

#define BU_GET(_ptr, _type)   _ptr = (_type *)bu_calloc(1, sizeof(_type), #_type " (BU_GET) " BU_FLSTR)
 
#define BU_PUT(_ptr, _type)   do { *(uint8_t *)(_type *)(_ptr) = /*zap*/ 0; bu_free(_ptr, #_type " (BU_PUT) " BU_FLSTR); _ptr = NULL; } while (0)
 
#define BU_ALLOC(_ptr, _type)   _ptr = (_type *)bu_calloc(1, sizeof(_type), #_type " (BU_ALLOC) " BU_FLSTR)
 
#define BU_FREE(_ptr, _type)   do { bu_free(_ptr, #_type " (BU_FREE) " BU_FLSTR); _ptr = (_type *)NULL; } while (0)
 

Typedefs

typedef int(* bu_heap_func_t) (const char *,...)
 

Functions

void * bu_malloc (size_t siz, const char *str)
 
void * bu_calloc (size_t nelem, size_t elsize, const char *str)
 
void bu_free (void *ptr, const char *str)
 
void * bu_realloc (void *ptr, size_t siz, const char *str)
 
void bu_prmem (const char *str)
 
int bu_malloc_len_roundup (int nbytes)
 
void bu_ck_malloc_ptr (void *ptr, const char *str)
 
int bu_mem_barriercheck (void)
 
void * bu_heap_get (size_t sz)
 
void bu_heap_put (void *ptr, size_t sz)
 
bu_heap_func_t bu_heap_log (bu_heap_func_t log)
 
int bu_shmget (int *shmid, char **shared_memory, int key, size_t size)
 

Variables

long bu_n_malloc
 
long bu_n_realloc