[Core] Track who calls memory pool destroy.

This commit is contained in:
Andrey Volk 2020-03-05 22:58:12 +04:00
parent 8e0c0df5b6
commit 4dc52cfb4b
2 changed files with 12 additions and 1 deletions

View File

@ -463,7 +463,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line)
{
char *tmp;
const char *tag;
switch_assert(pool != NULL);
/* In tag we store who calls the pool creation.
Now we append it with who calls the pool destroy.
*/
if (*pool) {
tag = apr_pool_tag(*pool, NULL);
tmp = switch_core_sprintf(*pool, "%s,%s:%d", (tag ? tag : ""), file, line);
apr_pool_tag(*pool, tmp);
}
#ifdef DEBUG_ALLOC2
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Free Pool %s\n", (void *) *pool, apr_pool_tag(*pool, NULL));

View File

@ -54,7 +54,7 @@ static struct {
int task_thread_running;
switch_queue_t *event_queue;
switch_memory_pool_t *memory_pool;
} globals;
} globals = { 0 };
static void switch_scheduler_execute(switch_scheduler_task_container_t *tp)
{