Asterisk - The Open Source Telephony Project  21.4.1
Macros | Functions
main/astmm.c File Reference

Memory Management. More...

#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/logger.h"

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.
 

Detailed Description

Memory Management.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m
Richard Mudgett rmudg.nosp@m.ett@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Definition in file main/astmm.c.

Macro Definition Documentation

#define DEBUG_CHAOS_RETURN (   c,
 
)

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 main/astmm.c.

Function Documentation

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 main/astmm.c.

1740 {
1741  ast_free(ptr);
1742 }
void load_astmm_phase_1 ( void  )

Initialize malloc debug phase 1.

Note
Must be called first thing after forking.

Definition at line 1525 of file main/astmm.c.

1526 {
1527 }