mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
pjproject: Add cache_pools debugging option.
The pool cache gets in the way of finding use after free errors of memory pool contents. Tools like valgrind and MALLOC_DEBUG don't know when a pool is released because it gets put into the cache instead of being freed. * Added the "cache_pools" option to pjproject.conf. Disabling the option helps track down pool content mismanagement when using valgrind or MALLOC_DEBUG. The cache gets in the way of determining if the pool contents are used after free and who freed it. To disable the pool caching simply disable the cache_pools option in pjproject.conf and restart Asterisk. Sample pjproject.conf setting: [startup] cache_pools=no * Made current users of the caching pool factory initialization and destruction calls call common routines to create and destroy cached pools. ASTERISK-27704 Change-Id: I64d5befbaeed2532f93aa027a51eb52347d2b828
This commit is contained in:
@@ -331,6 +331,7 @@ int option_verbose; /*!< Verbosity level */
|
||||
int option_debug; /*!< Debug level */
|
||||
int ast_pjproject_max_log_level = -1;/* Default to -1 to know if we have read the level from pjproject yet. */
|
||||
int ast_option_pjproject_log_level;
|
||||
int ast_option_pjproject_cache_pools;
|
||||
double ast_option_maxload; /*!< Max load avg on system */
|
||||
int ast_option_maxcalls; /*!< Max number of active calls */
|
||||
int ast_option_maxfiles; /*!< Max number of open file handles (files, sockets) */
|
||||
@@ -3744,6 +3745,7 @@ static void read_pjproject_startup_options(void)
|
||||
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE | CONFIG_FLAG_NOREALTIME };
|
||||
|
||||
ast_option_pjproject_log_level = DEFAULT_PJ_LOG_MAX_LEVEL;
|
||||
ast_option_pjproject_cache_pools = DEFAULT_PJPROJECT_CACHE_POOLS;
|
||||
|
||||
cfg = ast_config_load2("pjproject.conf", "" /* core, can't reload */, config_flags);
|
||||
if (!cfg
|
||||
@@ -3762,6 +3764,8 @@ static void read_pjproject_startup_options(void)
|
||||
} else if (MAX_PJ_LOG_MAX_LEVEL < ast_option_pjproject_log_level) {
|
||||
ast_option_pjproject_log_level = MAX_PJ_LOG_MAX_LEVEL;
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "cache_pools")) {
|
||||
ast_option_pjproject_cache_pools = !ast_false(v->value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user