Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
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.
#define MALLOC_FAILURE_MSG ast_log_safe(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file) |
int __ast_asprintf | ( | const char * | file, |
int | lineno, | ||
const char * | func, | ||
char ** | strp, | ||
const char * | format, | ||
... | |||
) |
Definition at line 1680 of file astmm.c.
References __ast_repl_vasprintf(), make_ari_stubs::file, 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 1603 of file astmm.c.
References __ast_repl_calloc(), make_ari_stubs::file, 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 1615 of file astmm.c.
References __ast_repl_calloc_cache(), make_ari_stubs::file, 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 1628 of file astmm.c.
References __ast_repl_malloc(), make_ari_stubs::file, 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 1640 of file astmm.c.
References __ast_repl_realloc(), make_ari_stubs::file, 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 1580 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 1533 of file astmm.c.
References calloc, DEBUG_CHAOS_RETURN, and NULL.
Referenced by __ast_calloc().
|
static |
Definition at line 1540 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 1547 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 1559 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 1566 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 1573 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 1594 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 1652 of file astmm.c.
References __ast_repl_strdup(), make_ari_stubs::file, 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 1666 of file astmm.c.
References __ast_repl_strndup(), make_ari_stubs::file, 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 1701 of file astmm.c.
References __ast_repl_vasprintf(), make_ari_stubs::file, 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 1739 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(), 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(), refer_on_tx_request(), 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 | ||
) |
void ast_std_free | ( | void * | ptr | ) |
Definition at line 1734 of file astmm.c.
References free().
Referenced by action_filter(), as_check_common_config(), ast_ari_get_docs(), ast_safe_mkdir(), ast_stir_shaken_attest(), ast_stir_shaken_vs_verify(), crypto_get_cert_subject(), crypto_log_openssl(), curl_write_data_free(), module_destroy(), restrictedFile(), 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 1525 of file astmm.c.
Referenced by asterisk_daemon().
void load_astmm_phase_2 | ( | void | ) |
Initialize malloc debug phase 2.
Definition at line 1529 of file astmm.c.
Referenced by asterisk_daemon().