Asterisk - The Open Source Telephony Project
18.5.0
|
Memory Management. More...
Go to the source code of this file.
Macros | |
#define | ASTMM_LIBC ASTMM_IGNORE |
#define | DEBUG_CHAOS_RETURN(c, f) |
DEBUG_CHAOS returns failure randomly. More... | |
#define | MALLOC_FAILURE_MSG ast_log_safe(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file) |
Functions | |
int | __ast_asprintf (const char *file, int lineno, const char *func, char **strp, const char *format,...) |
void * | __ast_calloc (size_t nmemb, size_t size, const char *file, int lineno, const char *func) |
void * | __ast_calloc_cache (size_t nmemb, size_t size, const char *file, int lineno, const char *func) |
void | __ast_free (void *ptr, const char *file, int lineno, const char *func) |
void * | __ast_malloc (size_t size, const char *file, int lineno, const char *func) |
void * | __ast_realloc (void *ptr, size_t size, const char *file, int lineno, const char *func) |
int | __ast_repl_asprintf (const char *file, int lineno, const char *func, char **strp, const char *format,...) |
void * | __ast_repl_calloc (size_t nmemb, size_t size, const char *file, int lineno, const char *func) |
static void * | __ast_repl_calloc_cache (size_t nmemb, size_t size, const char *file, int lineno, const char *func) |
void * | __ast_repl_malloc (size_t size, const char *file, int lineno, const char *func) |
void * | __ast_repl_realloc (void *ptr, size_t size, const char *file, int lineno, const char *func) |
char * | __ast_repl_strdup (const char *s, const char *file, int lineno, const char *func) |
char * | __ast_repl_strndup (const char *s, size_t n, const char *file, int lineno, const char *func) |
int | __ast_repl_vasprintf (char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func) |
char * | __ast_strdup (const char *s, const char *file, int lineno, const char *func) |
char * | __ast_strndup (const char *s, size_t n, const char *file, int lineno, const char *func) |
int | __ast_vasprintf (char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func) |
void | ast_free_ptr (void *ptr) |
free() wrapper More... | |
void * | ast_std_calloc (size_t nmemb, size_t size) |
void | ast_std_free (void *ptr) |
void * | ast_std_malloc (size_t size) |
void * | ast_std_realloc (void *ptr, size_t size) |
void | load_astmm_phase_1 (void) |
Initialize malloc debug phase 1. More... | |
void | load_astmm_phase_2 (void) |
Initialize malloc debug phase 2. More... | |
Memory Management.
Definition in file astmm.c.
#define ASTMM_LIBC ASTMM_IGNORE |
#define DEBUG_CHAOS_RETURN | ( | c, | |
f | |||
) |
DEBUG_CHAOS returns failure randomly.
DEBUG_CHAOS_RETURN(failure); can be used to fake failure of functions such as memory allocation, for the purposes of testing failure handling.
Definition at line 59 of file astmm.c.
Referenced by __ast_repl_asprintf(), __ast_repl_calloc(), __ast_repl_calloc_cache(), __ast_repl_malloc(), __ast_repl_realloc(), __ast_repl_strdup(), __ast_repl_strndup(), and __ast_repl_vasprintf().
#define MALLOC_FAILURE_MSG ast_log_safe(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file) |
Definition at line 70 of file astmm.c.
Referenced by __ast_asprintf(), __ast_calloc(), __ast_calloc_cache(), __ast_malloc(), __ast_realloc(), __ast_strdup(), __ast_strndup(), and __ast_vasprintf().
int __ast_asprintf | ( | const char * | file, |
int | lineno, | ||
const char * | func, | ||
char ** | strp, | ||
const char * | format, | ||
... | |||
) |
Definition at line 1712 of file astmm.c.
References __ast_repl_vasprintf(), MALLOC_FAILURE_MSG, and NULL.
void* __ast_calloc | ( | size_t | nmemb, |
size_t | size, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1635 of file astmm.c.
References __ast_repl_calloc(), and MALLOC_FAILURE_MSG.
Referenced by __ast_calloc_with_stringfields(), __ast_datastore_alloc(), __ast_frdup(), _ast_hashtab_create(), _ast_hashtab_dup(), _ast_hashtab_insert_immediate_bucket(), _ast_hashtab_resize(), _ast_hashtab_start_traversal(), _ast_hashtab_start_write_traversal(), _ast_heap_create(), _ast_var_assign(), _ast_variable_new(), add_string_pool(), ast_frame_header_new(), and internal_ao2_alloc().
void* __ast_calloc_cache | ( | size_t | nmemb, |
size_t | size, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1647 of file astmm.c.
References __ast_repl_calloc_cache(), and MALLOC_FAILURE_MSG.
void __ast_free | ( | void * | ptr, |
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
void* __ast_malloc | ( | size_t | size, |
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1660 of file astmm.c.
References __ast_repl_malloc(), and MALLOC_FAILURE_MSG.
Referenced by __ast_cc_config_params_init(), and _ast_heap_create().
void* __ast_realloc | ( | void * | ptr, |
size_t | size, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1672 of file astmm.c.
References __ast_repl_realloc(), and MALLOC_FAILURE_MSG.
Referenced by grow_heap().
int __ast_repl_asprintf | ( | const char * | file, |
int | lineno, | ||
const char * | func, | ||
char ** | strp, | ||
const char * | format, | ||
... | |||
) |
Definition at line 1612 of file astmm.c.
References DEBUG_CHAOS_RETURN, and vasprintf().
void* __ast_repl_calloc | ( | size_t | nmemb, |
size_t | size, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1565 of file astmm.c.
References calloc, DEBUG_CHAOS_RETURN, and NULL.
Referenced by __ast_calloc().
|
static |
Definition at line 1572 of file astmm.c.
References calloc, DEBUG_CHAOS_RETURN, and NULL.
Referenced by __ast_calloc_cache().
void* __ast_repl_malloc | ( | size_t | size, |
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1579 of file astmm.c.
References DEBUG_CHAOS_RETURN, malloc(), and NULL.
Referenced by __ast_malloc().
void* __ast_repl_realloc | ( | void * | ptr, |
size_t | size, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1591 of file astmm.c.
References DEBUG_CHAOS_RETURN, NULL, and realloc.
Referenced by __ast_realloc().
char* __ast_repl_strdup | ( | const char * | s, |
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1598 of file astmm.c.
References DEBUG_CHAOS_RETURN, NULL, and strdup.
Referenced by __ast_strdup().
char* __ast_repl_strndup | ( | const char * | s, |
size_t | n, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1605 of file astmm.c.
References DEBUG_CHAOS_RETURN, NULL, and strndup().
Referenced by __ast_strndup().
int __ast_repl_vasprintf | ( | char ** | strp, |
const char * | format, | ||
va_list | ap, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1626 of file astmm.c.
References DEBUG_CHAOS_RETURN, and vasprintf().
Referenced by __ast_asprintf(), and __ast_vasprintf().
char* __ast_strdup | ( | const char * | s, |
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1684 of file astmm.c.
References __ast_repl_strdup(), MALLOC_FAILURE_MSG, and NULL.
char* __ast_strndup | ( | const char * | s, |
size_t | n, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1698 of file astmm.c.
References __ast_repl_strndup(), MALLOC_FAILURE_MSG, and NULL.
int __ast_vasprintf | ( | char ** | strp, |
const char * | format, | ||
va_list | ap, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 1733 of file astmm.c.
References __ast_repl_vasprintf(), MALLOC_FAILURE_MSG, and NULL.
void ast_free_ptr | ( | void * | ptr | ) |
free() wrapper
ast_free_ptr should be used when a function pointer for free() needs to be passed as the argument to a function. Otherwise, astmm will cause seg faults.
Definition at line 1771 of file astmm.c.
References ast_free.
Referenced by add_extension(), add_extensions(), add_to_regcontext(), app_create(), ast_hint_presence_state(), ast_merge_contexts_and_delete(), ast_rtp_prop_set(), ast_rtp_read(), ast_sip_persistent_endpoint_update_state(), AST_TEST_DEFINE(), attended_transfer_to_ami(), blind_transfer_to_ami(), confbridge_exec(), context_merge(), control_move_cleanup(), device_state_cb(), dynamic_dtmf_hook_add(), extension_state_add_destroy(), handle_cli_dialplan_add_extension(), handle_request_refer(), internal_extension_state_extended(), manager_dialplan_extension_add(), parking_add_extension(), parking_duration_callback(), pbx_load_config(), pbx_load_users(), pjsip_acf_dial_contacts_read(), register_exten(), register_peer_exten(), sla_build_station(), sla_build_trunk(), sorcery_astdb_retrieve_id(), stasis_app_control_add_role(), stasis_app_control_continue(), stasis_app_control_dtmf(), stasis_app_control_moh_start(), stasis_app_control_move(), stasis_app_control_mute(), stasis_app_control_redirect(), stasis_app_control_unmute(), and transmit_info_dtmf().
void* ast_std_calloc | ( | size_t | nmemb, |
size_t | size | ||
) |
Definition at line 1756 of file astmm.c.
References calloc.
Referenced by ast_get_reentrancy(), and ast_module_register().
void ast_std_free | ( | void * | ptr | ) |
Definition at line 1766 of file astmm.c.
References free().
Referenced by __dump_backtrace(), ast_ari_get_docs(), ast_safe_mkdir(), delete_reentrancy_cs(), module_destroy(), safe_mkdir(), split_path(), and stasis_app_stored_recording_find_by_name().
void* ast_std_malloc | ( | size_t | size | ) |
void* ast_std_realloc | ( | void * | ptr, |
size_t | size | ||
) |
void load_astmm_phase_1 | ( | void | ) |
Initialize malloc debug phase 1.
Definition at line 1557 of file astmm.c.
Referenced by asterisk_daemon().
void load_astmm_phase_2 | ( | void | ) |
Initialize malloc debug phase 2.
Definition at line 1561 of file astmm.c.
Referenced by asterisk_daemon().