/* Destroy all perl scripts and deinitialize perl interpreter */ void perl_scripts_deinit(void) { if (my_perl == NULL) return; /* unload all scripts */ while (perl_scripts != NULL) perl_script_unload(perl_scripts->data); signal_emit("perl scripts deinit", 0); perl_signals_stop(); perl_sources_stop(); perl_common_stop(); /* Unload all perl libraries loaded with dynaloader */ perl_eval_pv("foreach my $lib (@DynaLoader::dl_modules) { if ($lib =~ /^Irssi\\b/) { $lib .= '::deinit();'; eval $lib; } }", TRUE); /* We could unload all libraries .. but this crashes with some libraries, probably because we don't call some deinit function.. Anyway, this would free some memory with /SCRIPT RESET, but it leaks memory anyway. */ /*perl_eval_pv("eval { foreach my $lib (@DynaLoader::dl_librefs) { DynaLoader::dl_unload_file($lib); } }", TRUE);*/ /* perl interpreter */ perl_destruct(my_perl); perl_free(my_perl); my_perl = NULL; }
/* Destroy all perl scripts and deinitialize perl interpreter */ void perl_scripts_deinit(void) { if (my_perl == NULL) return; /* unload all scripts */ while (perl_scripts != NULL) perl_script_unload(perl_scripts->data); signal_emit("perl scripts deinit", 0); perl_signals_stop(); perl_sources_stop(); perl_common_stop(); /* Unload all perl libraries loaded with dynaloader */ perl_eval_pv("foreach my $lib (@DynaLoader::dl_modules) { if ($lib =~ /^Irssi\\b/) { $lib .= '::deinit();'; eval $lib; } }", TRUE); #if PERL_STATIC_LIBS == 1 /* If perl is statically built we should manually deinit the modules which are booted in boot_Irssi_Core above */ perl_eval_pv("foreach my $lib (qw(" "Irssi" " " "Irssi::Irc" " " "Irssi::UI" " " "Irssi::TextUI" ")) { eval $lib . '::deinit();'; }", TRUE); #endif /* We could unload all libraries .. but this crashes with some libraries, probably because we don't call some deinit function.. Anyway, this would free some memory with /SCRIPT RESET, but it leaks memory anyway. */ /*perl_eval_pv("eval { foreach my $lib (@DynaLoader::dl_librefs) { DynaLoader::dl_unload_file($lib); } }", TRUE);*/ /* perl interpreter */ PL_perl_destruct_level = 1; perl_destruct(my_perl); perl_free(my_perl); my_perl = NULL; }