MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cleanup

Function cleanup

shutdown.c:49–103  ·  view source on GitHub ↗

* Clean up on exit. This should be called before exiting. * \param show_status set to one to display the mem status */

Source from the content-addressed store, hash-verified

47 * \param show_status set to one to display the mem status
48 */
49void cleanup(int show_status)
50{
51 LM_INFO("cleanup\n");
52
53 /*clean-up*/
54
55#ifdef DBG_MALLOC
56 if (shm_memlog_size && mem_dbg_lock)
57 shm_dbg_unlock();
58#endif
59
60 handle_ql_shutdown();
61 destroy_modules();
62 udp_destroy();
63 tcp_destroy();
64 destroy_timer();
65 if (shm_memlog_size)
66 shm_mem_disable_dbg();
67 destroy_stats_collector();
68 destroy_script_cb();
69 pv_free_extra_list();
70 tr_free_extra_list();
71 destroy_argv_list();
72 destroy_black_lists();
73 free_route_lists(sroutes); // this is just for testing purposes
74#ifdef PKG_MALLOC
75 if (show_status){
76 LM_GEN1(memdump, "Memory status (pkg):\n");
77 pkg_status();
78 }
79#endif
80 cleanup_log_level();
81
82 if (pt && (0
83#if defined F_MALLOC || defined Q_MALLOC
84 || mem_lock
85#endif
86#ifdef HP_MALLOC
87 || mem_locks
88#endif
89 ))
90 shm_free(pt);
91 pt=0;
92 if (show_status){
93 LM_GEN1(memdump, "Memory status (shm):\n");
94 shm_status();
95 }
96
97 cleanup_log_cons_shm_table();
98
99 /* zero all shmem alloc vars that we still use */
100 shm_mem_destroy();
101 if (pid_file) unlink(pid_file);
102 if (pgid_file) unlink(pgid_file);
103}
104
105
106/**

Callers 2

shutdown_opensipsFunction · 0.70
mainFunction · 0.70

Calls 15

handle_ql_shutdownFunction · 0.85
destroy_modulesFunction · 0.85
udp_destroyFunction · 0.85
tcp_destroyFunction · 0.85
destroy_timerFunction · 0.85
shm_mem_disable_dbgFunction · 0.85
destroy_stats_collectorFunction · 0.85
destroy_script_cbFunction · 0.85
pv_free_extra_listFunction · 0.85
tr_free_extra_listFunction · 0.85
destroy_argv_listFunction · 0.85
destroy_black_listsFunction · 0.85

Tested by

no test coverage detected