malloc.c File Reference

Parallel-protected debugging-enhanced wrapper around system malloc(). More...

#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include "machine.h"
#include "bu.h"

Include dependency graph for malloc.c:

Go to the source code of this file.

Data Structures

struct  memdebug
struct  memqdebug

Defines

#define MDB_MAGIC   0x12348969
#define MEMDEBUG_NULL   ((struct memdebug *)0)
#define MEMQDEBUG_NULL   ((struct memqdebug *)0)

Enumerations

enum  alloc_t { MALLOC, CALLOC }

Functions

HIDDEN void bu_memdebug_add (char *ptr, unsigned int cnt, const char *str)
HIDDEN struct memdebugbu_memdebug_check (register char *ptr, const char *str)
genptr_t bu_malloc (unsigned int cnt, const char *str)
genptr_t bu_calloc (unsigned int nelem, unsigned int elsize, const char *str)
void bu_free (genptr_t ptr, const char *str)
genptr_t bu_realloc (register genptr_t ptr, unsigned int cnt, const char *str)
void bu_prmem (const char *str)
char * bu_strdupm (register const char *cp, const char *label)
char * bu_dirname (const char *cp)
int bu_malloc_len_roundup (register int nbytes)
void bu_ck_malloc_ptr (genptr_t ptr, const char *str)
int bu_mem_barriercheck ()
void bu_free_array (int argc, char *argv[], const char *str)

Variables

int bu_debug = 0
long bu_n_malloc = 0
long bu_n_free = 0
long bu_n_realloc = 0
const char bu_strdup_message [] = "bu_strdup string"
const char bu_vls_message []


Detailed Description

Parallel-protected debugging-enhanced wrapper around system malloc().

The bu_malloc() routines can't use bu_log() because that uses the bu_vls() routines which depend on bu_malloc(). So it goes direct to stderr, semaphore protected.

Functions
bu_malloc Allocate storage, with visibility & checking
bu_free Similarly, free storage
bu_realloc Reallocate storage, with visibility & checking
bu_calloc Allocate zero'ed storage
bu_prmem When debugging, print memory map
bu_strdup_body Duplicate a string in dynamic memory
bu_malloc_len_roundup Optimize sizing of malloc() requests
bu_free_array free elements of an array
Author:
Michael John Muuss

Christopher Sean Morrison

Source -
The U. S. Army Research Laboratory
Aberdeen Proving Ground, Maryland 21005-5068 USA

Definition in file malloc.c.


Generated on Mon Sep 18 01:25:04 2006 for BRL-CAD by  doxygen 1.4.6