Macros | Functions
memory_handler.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUG_BUFFER_BORDER   256
#define DEBUG_BUFFER_VALUE   69
#define DEBUG   0

Functions

int init_memory_handler ()
void * allocate_memory (int size)
void debug_print_memory ()
void free_memory (void *memory)
void true_free_memory (void *memory)
void free_all_memory ()

Macro Definition Documentation

#define DEBUG   0
#define DEBUG_BUFFER_BORDER   256
#define DEBUG_BUFFER_VALUE   69

Referenced by check_memory(), and fill_memory().


Function Documentation

void* allocate_memory ( int  size)

Allocate memory for atleast size bytes.

Parameters:
sizesize of memory in bytes
Returns:
pointer to memory if ok NULL if out of memory

References DEBUG, DEBUG_BUFFER_BORDER, fill_memory(), Memory_handler::mem, MEM_HANDLE, Memory_handler::next, Memory_handler::size, and Memory_handler::used.

Here is the call graph for this function:

void debug_print_memory ( )

Debug printing. Prints usage of memory and some info.

References DEBUG, Memory_handler::mem, MEM_HANDLE, Memory_handler::next, Memory_handler::size, and Memory_handler::used.

void free_all_memory ( )

Free all memory, permanently. Used as clean_up() function.

References Memory_handler::mem, Memory_handler::next, Memory_handler::size, and Memory_handler::used.

void free_memory ( void *  memory)

Sets memory free for re-use, but does not actually free any memory

Parameters:
memory

References _free_memory().

Here is the call graph for this function:

int init_memory_handler ( )

Initializes this whole handler thingie. MUST BE CALLED

Returns:
0 - on success, 1 - on failure (out of memory )

References DEBUG, Memory_handler::mem, Memory_handler::next, Memory_handler::size, and Memory_handler::used.

void true_free_memory ( void *  memory)

Does the really freeing memory, deallocates the memory.

Parameters:
memorypointer to memory

References _free_memory().

Here is the call graph for this function: