diff --git a/daemon/main.c b/daemon/main.c index 3baa623d0..8261c93c5 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -80,6 +80,7 @@ static GQueue rtpe_cli = G_QUEUE_INIT; GQueue rtpe_control_ng = G_QUEUE_INIT; GQueue rtpe_control_ng_tcp = G_QUEUE_INIT; struct bufferpool *shm_bufferpool; +memory_arena_t rtpe_arena; struct rtpengine_config rtpe_config = { // non-zero defaults @@ -1398,6 +1399,8 @@ RTPE_CONFIG_CHARPP_PARAMS static void early_init(void) { socket_init(); // needed for socktype_udp + memory_arena_init(&rtpe_arena); + memory_arena = &rtpe_arena; } #ifdef WITH_TRANSCODING @@ -1881,6 +1884,7 @@ int main(int argc, char **argv) { kernel_shutdown_table(); options_free(); bufferpool_cleanup(); + memory_arena_free(&rtpe_arena); return 0; } diff --git a/include/call.h b/include/call.h index db4e2befe..83539dea2 100644 --- a/include/call.h +++ b/include/call.h @@ -943,7 +943,7 @@ INLINE void call_memory_arena_release(void) { return; obj_put(call_memory_arena); call_memory_arena = NULL; - memory_arena = NULL; + memory_arena = &rtpe_arena; } INLINE void call_memory_arena_set(call_t *c) { call_memory_arena_release(); diff --git a/include/main.h b/include/main.h index 1bfc4cc1b..67f60075d 100644 --- a/include/main.h +++ b/include/main.h @@ -7,6 +7,7 @@ #include "socket.h" #include "auxlib.h" #include "types.h" +#include "arena.h" enum xmlrpc_format { XF_SEMS = 0, @@ -320,6 +321,7 @@ extern GQueue rtpe_control_ng; extern GQueue rtpe_control_ng_tcp; extern struct bufferpool *shm_bufferpool; +extern memory_arena_t rtpe_arena; #endif diff --git a/t/test-stats.c b/t/test-stats.c index 1db29e253..d739c58d7 100644 --- a/t/test-stats.c +++ b/t/test-stats.c @@ -25,6 +25,7 @@ unsigned int rtpe_poller_rr_iter; GString *dtmf_logs; GQueue rtpe_control_ng = G_QUEUE_INIT; struct bufferpool *shm_bufferpool; +memory_arena_t rtpe_arena; static void __assert_g_string_eq(GString *a, const char *b, unsigned int line) { if (strcmp(a->str, b) == 0) { diff --git a/t/test-transcode.c b/t/test-transcode.c index cbb44fb08..aa83ebced 100644 --- a/t/test-transcode.c +++ b/t/test-transcode.c @@ -20,6 +20,7 @@ unsigned int rtpe_poller_rr_iter; GString *dtmf_logs; GQueue rtpe_control_ng = G_QUEUE_INIT; struct bufferpool *shm_bufferpool; +memory_arena_t rtpe_arena; static str *sdup(char *s) { str r = STR(s);