#include <eh_utils.h>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
struct | Heap_Prefix |
struct | Heap_Postfix |
Defines | |
#define | EH_MEM_TABLE_SIZE (40960) |
#define | ALIGNMENT (8) |
#define | DO_ALIGN(x) (((x)+ALIGNMENT-1)&~(ALIGNMENT-1)) |
Typedefs | |
typedef Heap_Prefix * | Heap_Prefix |
typedef Heap_Postfix * | Heap_Postfix |
typedef Heap_Prefix | Prefix |
typedef Heap_Postfix | Postfix |
Enumerations | |
enum | Eh_mem_job { EH_MEM_PROFILE_MALLOC, EH_MEM_PROFILE_REALLOC, EH_MEM_PROFILE_FREE } |
Functions | |
void | eh_mem_profile_log (Eh_mem_job job, gulong size) |
void | eh_mem_profile_fprint (FILE *fp) |
eh_compiler_require (IS_POWER_2(ALIGNMENT)) | |
eh_compiler_require (!(sizeof(Prefix)%ALIGNMENT)) | |
G_GNUC_INTERNAL void | add_to_linked_list (Heap_Prefix) |
G_GNUC_INTERNAL void | remove_from_linked_list (Heap_Prefix) |
G_GNUC_INTERNAL gboolean | verify_heap_pointer (void *) |
G_GNUC_INTERNAL gsize | render_desc (Heap_Prefix, char *) |
gpointer API_ENTRY | eh_malloc (gsize w_size, Class_Desc desc, const char *file, int line_no) |
gpointer API_ENTRY | eh_malloc_c_style (gsize w_size) |
gpointer API_ENTRY | eh_calloc_c_style (gsize n_blocks, gsize n_block_bytes) |
gpointer API_ENTRY | eh_realloc (gpointer old, gsize w_size, const char *file, int line_no) |
gpointer API_ENTRY | eh_realloc_c_style (gpointer old, gsize w_size) |
void API_ENTRY | eh_walk_heap (void) |
glong | eh_mem_in_use (void) |
gboolean API_ENTRY | eh_is_ptr_ok (gpointer mem) |
void API_ENTRY | report_win_assert (char *file_name, int line_no) |
void ** | eh_alloc_2 (gssize m, gssize n, gssize size) |
void | eh_free_void_2 (void **p) |
#define ALIGNMENT (8) |
#define DO_ALIGN | ( | x | ) | (((x)+ALIGNMENT-1)&~(ALIGNMENT-1)) |
#define EH_MEM_TABLE_SIZE (40960) |
Definition at line 5 of file eh_mem.c.
Referenced by eh_mem_profile_fprint(), and eh_mem_profile_log().
typedef struct Heap_Postfix* Heap_Postfix |
typedef struct Heap_Prefix* Heap_Prefix |
typedef struct Heap_Postfix Postfix |
typedef struct Heap_Prefix Prefix |
enum Eh_mem_job |
void add_to_linked_list | ( | Heap_Prefix | ) |
Definition at line 438 of file eh_mem.c.
References Heap_Prefix::next, and Heap_Prefix::prev.
Referenced by eh_malloc(), and eh_realloc().
void** eh_alloc_2 | ( | gssize | m, | |
gssize | n, | |||
gssize | size | |||
) |
gpointer API_ENTRY eh_calloc_c_style | ( | gsize | n_blocks, | |
gsize | n_block_bytes | |||
) |
eh_compiler_require | ( | ! | (sizeof(Prefix)%ALIGNMENT) | ) |
eh_compiler_require | ( | IS_POWER_2(ALIGNMENT) | ) |
gboolean API_ENTRY eh_is_ptr_ok | ( | gpointer | mem | ) |
gpointer API_ENTRY eh_malloc | ( | gsize | w_size, | |
Class_Desc | desc, | |||
const char * | file, | |||
int | line_no | |||
) |
Definition at line 166 of file eh_mem.c.
References add_to_linked_list(), assert_error, DO_ALIGN, eh_mem_profile_log(), EH_MEM_PROFILE_MALLOC, and eh_require.
Referenced by eh_calloc_c_style(), eh_malloc_c_style(), and eh_realloc().
gpointer API_ENTRY eh_malloc_c_style | ( | gsize | w_size | ) |
void eh_mem_profile_fprint | ( | FILE * | fp | ) |
void eh_mem_profile_log | ( | Eh_mem_job | job, | |
gulong | size | |||
) |
Definition at line 26 of file eh_mem.c.
References EH_MEM_PROFILE_FREE, EH_MEM_PROFILE_MALLOC, EH_MEM_PROFILE_REALLOC, and EH_MEM_TABLE_SIZE.
Referenced by eh_malloc(), and eh_realloc().
gpointer API_ENTRY eh_realloc | ( | gpointer | old, | |
gsize | w_size, | |||
const char * | file, | |||
int | line_no | |||
) |
Definition at line 269 of file eh_mem.c.
References add_to_linked_list(), assert_error, DO_ALIGN, eh_malloc(), EH_MEM_PROFILE_FREE, eh_mem_profile_log(), EH_MEM_PROFILE_REALLOC, Heap_Prefix::mem, Heap_Prefix::postfix, Heap_Postfix::prefix, remove_from_linked_list(), and verify_heap_pointer().
Referenced by eh_realloc_c_style().
gpointer API_ENTRY eh_realloc_c_style | ( | gpointer | old, | |
gsize | w_size | |||
) |
Definition at line 321 of file eh_mem.c.
References eh_free_c_style(), and eh_realloc().
Referenced by eh_init_glib().
void API_ENTRY eh_walk_heap | ( | void | ) |
Definition at line 341 of file eh_mem.c.
References Heap_Prefix::next, render_desc(), and verify_heap_pointer().
void remove_from_linked_list | ( | Heap_Prefix | ) |
Definition at line 456 of file eh_mem.c.
References Heap_Prefix::next, and Heap_Prefix::prev.
Referenced by eh_realloc().
gsize render_desc | ( | Heap_Prefix | , | |
char * | ||||
) |
Definition at line 506 of file eh_mem.c.
References Heap_Prefix::class_desc, Heap_Prefix::file_name, Heap_Prefix::line_no, Heap_Prefix::mem, and Heap_Prefix::postfix.
Referenced by eh_walk_heap().
void API_ENTRY report_win_assert | ( | char * | file_name, | |
int | line_no | |||
) |
gboolean verify_heap_pointer | ( | void * | ) |
Definition at line 468 of file eh_mem.c.
References eh_is_ptr_ok(), Heap_Prefix::mem, Heap_Prefix::postfix, and Heap_Postfix::prefix.
Referenced by eh_realloc(), and eh_walk_heap().