Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

c_allocator.c File Reference

#include <stdlib.h>
#include <assert.h>
#include "debug/c_allocator.h"
#include "debug/macros.h"

Defines

#define HASH(PTR)   (((PTR) >> 2) & (debug_ALLOCATION_TABLE-1))
 Easy hash of a pointer: remove 2 lower bits (==0) modulo size of allocation table.

Functions

int32_t * debug_malloc (size_t intSize, void *debugAllocations)
 Debug allocator function based on malloc.
void debug_free (void *ptr, size_t intSize, void *debugAllocations)
 Debug free function, to free memory allocated by debug_malloc.
void debug_destroyAllocator (allocator_t *debugAllocator)
 Destroy a debug allocator and check it for leaks.

Define Documentation

#define HASH PTR   )     (((PTR) >> 2) & (debug_ALLOCATION_TABLE-1))
 

Easy hash of a pointer: remove 2 lower bits (==0) modulo size of allocation table.


Function Documentation

void debug_destroyAllocator allocator_t debugAllocator  ) 
 

Destroy a debug allocator and check it for leaks.

Parameters:
debugAllocator,: an allocator as initialized by debug_initAllocator

void debug_free void *  ptr,
size_t  intSize,
void *  debugAllocations
 

Debug free function, to free memory allocated by debug_malloc.

Parameters:
ptr,: memory to deallocate.
intSize,: size to deallocate
debugAllocations,: all the allocations.

int32_t* debug_malloc size_t  intSize,
void *  debugAllocations
 

Debug allocator function based on malloc.

Parameters:
intSize,: size to allocate in ints
debugAllocations,: a debug_allocation_t**
Returns:
int32_t[intSize] allocated by malloc


Generated on Fri Jun 30 00:02:51 2006 for Module debug by  doxygen 1.4.2