Add MALLOC_DEBUG atexit unreleased malloc memory summary.

* Adds the following CLI commands to control MALLOC_DEBUG reporting of
unreleased malloc memory when Asterisk is shut down.
memory atexit list on
memory atexit list off
memory atexit summary byline
memory atexit summary byfunc
memory atexit summary byfile
memory atexit summary off

* Made check all remaining allocated region blocks atexit for fence
violations.

* Increased the allocated region hash table size by about three times.  It
still isn't large enough considering the number of malloced blocks
Asterisk uses.

* Made CLI "memory show allocations anomalies" use
regions_check_all_fences().

Review: https://reviewboard.asterisk.org/r/2196/
........

Merged revisions 376788 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376789 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 376790 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2012-11-29 00:48:12 +00:00
parent e3a487d492
commit 2686dde98b
2 changed files with 588 additions and 38 deletions

View File

@@ -3965,6 +3965,10 @@ int main(int argc, char *argv[])
* an Asterisk instance, and that there isn't one already running. */
multi_thread_safe = 1;
#if defined(__AST_DEBUG_MALLOC)
__ast_mm_init_phase_1();
#endif /* defined(__AST_DEBUG_MALLOC) */
/* Spawning of astcanary must happen AFTER the call to daemon(3) */
if (isroot && ast_opt_high_priority) {
snprintf(canary_filename, sizeof(canary_filename), "%s/alt.asterisk.canary.tweet.tweet.tweet", ast_config_AST_RUN_DIR);
@@ -4034,10 +4038,6 @@ int main(int argc, char *argv[])
ast_el_read_history(filename);
}
#if defined(__AST_DEBUG_MALLOC)
__ast_mm_init_phase_1();
#endif /* defined(__AST_DEBUG_MALLOC) */
ast_ulaw_init();
ast_alaw_init();
tdd_init();
@@ -4271,9 +4271,9 @@ int main(int argc, char *argv[])
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
#ifdef __AST_DEBUG_MALLOC
#if defined(__AST_DEBUG_MALLOC)
__ast_mm_init_phase_2();
#endif
#endif /* defined(__AST_DEBUG_MALLOC) */
ast_lastreloadtime = ast_startuptime = ast_tvnow();
ast_cli_register_multiple(cli_asterisk, ARRAY_LEN(cli_asterisk));