/** * Clean up on exit. This should be called before exiting. * \param show_status set to one to display the mem status */ void cleanup(int show_status) { LM_INFO("cleanup\n"); /*clean-up*/ /* hack: force-unlock the shared memory lock in case some process crashed and let it locked; this will allow an almost gracious shutdown */ if (mem_lock) #ifdef HP_MALLOC { int i; for (i = 0; i < HP_HASH_SIZE; i++) shm_unlock(i); } #else shm_unlock(); #endif handle_ql_shutdown(); destroy_modules(); #ifdef USE_TCP destroy_tcp(); #endif #ifdef USE_TLS destroy_tls(); #endif destroy_timer(); destroy_stats_collector(); destroy_script_cb(); pv_free_extra_list(); destroy_argv_list(); destroy_black_lists(); #ifdef PKG_MALLOC if (show_status){ LM_GEN1(memdump, "Memory status (pkg):\n"); pkg_status(); } #endif #ifdef SHM_MEM cleanup_debug(); if (pt) shm_free(pt); pt=0; if (show_status){ LM_GEN1(memdump, "Memory status (shm):\n"); shm_status(); } /* zero all shmem alloc vars that we still use */ shm_mem_destroy(); #endif if (pid_file) unlink(pid_file); if (pgid_file) unlink(pgid_file); }
/** * Clean up on exit. This should be called before exiting. * \param show_status set to one to display the mem status */ void cleanup(int show_status) { LM_INFO("cleanup\n"); /*clean-up*/ if (mem_lock) shm_unlock(); /* hack: force-unlock the shared memory lock in case some process crashed and let it locked; this will allow an almost gracious shutdown */ handle_ql_shutdown(); destroy_modules(); #ifdef USE_TCP destroy_tcp(); #endif #ifdef USE_TLS destroy_tls(); #endif destroy_timer(); destroy_stats_collector(); destroy_script_cb(); pv_free_extra_list(); destroy_argv_list(); destroy_black_lists(); #ifdef CHANGEABLE_DEBUG_LEVEL if (debug!=&debug_init) { reset_proc_debug_level(); debug_init = *debug; shm_free(debug); debug = &debug_init; } #endif #ifdef PKG_MALLOC if (show_status){ LM_GEN1(memdump, "Memory status (pkg):\n"); pkg_status(); } #endif #ifdef SHM_MEM if (pt) shm_free(pt); pt=0; if (show_status){ LM_GEN1(memdump, "Memory status (shm):\n"); shm_status(); } /* zero all shmem alloc vars that we still use */ shm_mem_destroy(); #endif if (pid_file) unlink(pid_file); if (pgid_file) unlink(pgid_file); }
/* call it before exiting; if show_status==1, mem status is displayed */ void cleanup(show_status) { /*clean-up*/ if (mem_lock) shm_unlock(); /* hack: force-unlock the shared memory lock in case some process crashed and let it locked; this will allow an almost gracious shutdown */ destroy_modules(); #ifdef USE_TCP destroy_tcp(); #endif #ifdef USE_TLS destroy_tls(); #endif destroy_timer(); close_unixsock_server(); destroy_fifo(); destroy_script_cb(); #ifdef PKG_MALLOC if (show_status){ LOG(memlog, "Memory status (pkg):\n"); pkg_status(); } #endif #ifdef SHM_MEM if (pt) shm_free(pt); pt=0; if (show_status){ LOG(memlog, "Memory status (shm):\n"); shm_status(); } /* zero all shmem alloc vars that we still use */ shm_mem_destroy(); #endif if (pid_file) unlink(pid_file); if (pgid_file) unlink(pgid_file); }