gwenhywfar  4.99.15beta
Functions | Variables
memory.c File Reference
#include "memory_p.h"
#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/types.h>
#include <gwenhywfar/stringlist.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Include dependency graph for memory.c:

Go to the source code of this file.

Functions

unsigned char * GWEN_Memory__FindFreeBlock (unsigned short dsize)
 
void * GWEN_Memory__Malloc (unsigned short dsize)
 
void GWEN_Memory_Collect (void)
 
void GWEN_Memory_dealloc (void *p)
 
void GWEN_Memory_Dump (void)
 
void * GWEN_Memory_malloc (size_t wsize)
 
int GWEN_Memory_ModuleFini (void)
 
int GWEN_Memory_ModuleInit (void)
 
void * GWEN_Memory_realloc (void *oldp, size_t nsize)
 
void GWEN_Memory_Report (void)
 
char * GWEN_Memory_strdup (const char *s)
 
void GWEN_Memory_Table__Collect (GWEN_MEMORY_TABLE *mt)
 
void GWEN_Memory_Table__CollectAt (GWEN_MEMORY_TABLE *mt, unsigned char *p)
 
void GWEN_Memory_Table__Dump (GWEN_MEMORY_TABLE *mt)
 
unsigned char * GWEN_Memory_Table__FindFreeBlock (GWEN_MEMORY_TABLE *mt, unsigned short dsize)
 
void GWEN_Memory_Table_Append (GWEN_MEMORY_TABLE *head, GWEN_MEMORY_TABLE *mt)
 
void GWEN_Memory_Table_free (GWEN_MEMORY_TABLE *mt)
 
void GWEN_Memory_Table_Insert (GWEN_MEMORY_TABLE *mt)
 
GWEN_MEMORY_TABLE * GWEN_Memory_Table_new (void)
 

Variables

static size_t gwen_memory__allocated_bytes =0
 
static size_t gwen_memory__allocated_calls =0
 
static size_t gwen_memory__allocated_reused =0
 
static int gwen_memory__debug =0
 
static GWEN_MEMORY_TABLE * gwen_memory__first_table =0
 
static int gwen_memory__nofree =0
 
static int gwen_memory__verbous =0
 

Function Documentation

◆ GWEN_Memory__FindFreeBlock()

unsigned char* GWEN_Memory__FindFreeBlock ( unsigned short  dsize)

Definition at line 327 of file memory.c.

References gwen_memory__first_table, GWEN_Memory_Table__FindFreeBlock(), GWEN_Memory_Table_Insert(), and GWEN_Memory_Table_new().

Referenced by GWEN_Memory__Malloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Memory__Malloc()

void* GWEN_Memory__Malloc ( unsigned short  dsize)

Definition at line 361 of file memory.c.

References gwen_memory__allocated_reused, and GWEN_Memory__FindFreeBlock().

Referenced by GWEN_Memory_malloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Memory_Collect()

void GWEN_Memory_Collect ( void  )

Definition at line 581 of file memory.c.

References gwen_memory__first_table, and GWEN_Memory_Table__Collect().

Referenced by GWEN_Memory_dealloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Memory_dealloc()

void GWEN_Memory_dealloc ( void *  p)

◆ GWEN_Memory_Dump()

void GWEN_Memory_Dump ( void  )

Definition at line 568 of file memory.c.

References gwen_memory__first_table, and GWEN_Memory_Table__Dump().

Here is the call graph for this function:

◆ GWEN_Memory_malloc()

void* GWEN_Memory_malloc ( size_t  wsize)

◆ GWEN_Memory_ModuleFini()

int GWEN_Memory_ModuleFini ( void  )

Definition at line 80 of file memory.c.

References gwen_memory__allocated_bytes, gwen_memory__allocated_calls, gwen_memory__allocated_reused, gwen_memory__first_table, gwen_memory__verbous, and GWEN_Memory_Table_free().

Referenced by GWEN_Fini().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Memory_ModuleInit()

int GWEN_Memory_ModuleInit ( void  )

Definition at line 64 of file memory.c.

References gwen_memory__debug, gwen_memory__nofree, and gwen_memory__verbous.

Referenced by GWEN_Init().

Here is the caller graph for this function:

◆ GWEN_Memory_realloc()

void* GWEN_Memory_realloc ( void *  oldp,
size_t  nsize 
)

Definition at line 447 of file memory.c.

References GWEN_Memory_dealloc(), and GWEN_Memory_malloc().

Referenced by GWEN_Buffer_AllocRoom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Memory_Report()

void GWEN_Memory_Report ( void  )

Definition at line 128 of file memory.c.

◆ GWEN_Memory_strdup()

char* GWEN_Memory_strdup ( const char *  s)

◆ GWEN_Memory_Table__Collect()

void GWEN_Memory_Table__Collect ( GWEN_MEMORY_TABLE *  mt)

Definition at line 282 of file memory.c.

References GWEN_Memory_Table__CollectAt().

Referenced by GWEN_Memory_Collect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Memory_Table__CollectAt()

void GWEN_Memory_Table__CollectAt ( GWEN_MEMORY_TABLE *  mt,
unsigned char *  p 
)

Definition at line 243 of file memory.c.

Referenced by GWEN_Memory_Table__Collect().

Here is the caller graph for this function:

◆ GWEN_Memory_Table__Dump()

void GWEN_Memory_Table__Dump ( GWEN_MEMORY_TABLE *  mt)

Definition at line 302 of file memory.c.

Referenced by GWEN_Memory_Dump().

Here is the caller graph for this function:

◆ GWEN_Memory_Table__FindFreeBlock()

unsigned char* GWEN_Memory_Table__FindFreeBlock ( GWEN_MEMORY_TABLE *  mt,
unsigned short  dsize 
)

Definition at line 210 of file memory.c.

Referenced by GWEN_Memory__FindFreeBlock().

Here is the caller graph for this function:

◆ GWEN_Memory_Table_Append()

void GWEN_Memory_Table_Append ( GWEN_MEMORY_TABLE *  head,
GWEN_MEMORY_TABLE *  mt 
)

Definition at line 187 of file memory.c.

◆ GWEN_Memory_Table_free()

void GWEN_Memory_Table_free ( GWEN_MEMORY_TABLE *  mt)

Definition at line 157 of file memory.c.

References gwen_memory__debug.

Referenced by GWEN_Memory_ModuleFini().

Here is the caller graph for this function:

◆ GWEN_Memory_Table_Insert()

void GWEN_Memory_Table_Insert ( GWEN_MEMORY_TABLE *  mt)

Definition at line 202 of file memory.c.

References gwen_memory__first_table.

Referenced by GWEN_Memory__FindFreeBlock().

Here is the caller graph for this function:

◆ GWEN_Memory_Table_new()

GWEN_MEMORY_TABLE* GWEN_Memory_Table_new ( void  )

Definition at line 137 of file memory.c.

References gwen_memory__verbous.

Referenced by GWEN_Memory__FindFreeBlock().

Here is the caller graph for this function:

Variable Documentation

◆ gwen_memory__allocated_bytes

size_t gwen_memory__allocated_bytes =0
static

Definition at line 54 of file memory.c.

Referenced by GWEN_Memory_malloc(), and GWEN_Memory_ModuleFini().

◆ gwen_memory__allocated_calls

size_t gwen_memory__allocated_calls =0
static

Definition at line 55 of file memory.c.

Referenced by GWEN_Memory_malloc(), and GWEN_Memory_ModuleFini().

◆ gwen_memory__allocated_reused

size_t gwen_memory__allocated_reused =0
static

Definition at line 56 of file memory.c.

Referenced by GWEN_Memory__Malloc(), and GWEN_Memory_ModuleFini().

◆ gwen_memory__debug

int gwen_memory__debug =0
static

Definition at line 51 of file memory.c.

Referenced by GWEN_Memory_ModuleInit(), and GWEN_Memory_Table_free().

◆ gwen_memory__first_table

GWEN_MEMORY_TABLE* gwen_memory__first_table =0
static

◆ gwen_memory__nofree

int gwen_memory__nofree =0
static

Definition at line 52 of file memory.c.

Referenced by GWEN_Memory_dealloc(), and GWEN_Memory_ModuleInit().

◆ gwen_memory__verbous

int gwen_memory__verbous =0
static