My Project
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

◆ DEBUG

#define DEBUG   0

◆ DEBUG_BUFFER_BORDER

#define DEBUG_BUFFER_BORDER   256

◆ DEBUG_BUFFER_VALUE

#define DEBUG_BUFFER_VALUE   69

Function Documentation

◆ allocate_memory()

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:

◆ debug_print_memory()

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.

◆ free_all_memory()

void free_all_memory ( )

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

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

◆ free_memory()

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:

◆ init_memory_handler()

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, MEM_HANDLE, Memory_handler::next, Memory_handler::size, and Memory_handler::used.

◆ true_free_memory()

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: