/**************************************************************************\ * To test for memory leaks, set MEMORY_LEAK_DEBUG to 1 using * "configure --enable-memory-leak-debug" then execute * $ valgrind --tool=memcheck --leak-check=yes --num-callers=8 \ * --leak-resolution=med ./slurmd -Dc >valg.slurmd.out 2>&1 * * Then exercise the slurmd functionality before executing * > scontrol shutdown * * All allocated memory should be freed \**************************************************************************/ static int _slurmd_fini(void) { switch_g_node_fini(); jobacct_gather_fini(); acct_gather_profile_fini(); save_cred_state(conf->vctx); switch_fini(); slurmd_task_fini(); slurm_conf_destroy(); slurm_proctrack_fini(); slurm_auth_fini(); node_fini2(); gres_plugin_fini(); slurm_topo_fini(); slurmd_req(NULL); /* purge memory allocated by slurmd_req() */ fini_setproctitle(); slurm_select_fini(); spank_slurmd_exit(); cpu_freq_fini(); job_container_fini(); acct_gather_conf_destroy(); return SLURM_SUCCESS; }
extern int acct_gather_profile_fini(void) { int rc = SLURM_SUCCESS, i; if (!g_context) return SLURM_SUCCESS; slurm_mutex_lock(&g_context_lock); if (!g_context) goto done; init_run = false; for (i=0; i < PROFILE_CNT; i++) { switch (i) { case PROFILE_ENERGY: acct_gather_energy_fini(); break; case PROFILE_TASK: jobacct_gather_fini(); break; case PROFILE_FILESYSTEM: acct_gather_filesystem_fini(); break; case PROFILE_NETWORK: acct_gather_infiniband_fini(); break; default: fatal("Unhandled profile option %d please update " "slurm_acct_gather_profile.c " "(acct_gather_profile_fini)", i); } } if (timer_thread_id) { pthread_cancel(timer_thread_id); pthread_join(timer_thread_id, NULL); } rc = plugin_context_destroy(g_context); g_context = NULL; done: slurm_mutex_unlock(&g_context_lock); return rc; }