mirror of https://github.com/bochs-emu/Bochs
address most of the memory leaks
the param tree, siminterface log and SIM were not released handle all but SIM for now should reduce the memory leaks list dramatically
This commit is contained in:
parent
7f04cfd8df
commit
081d5e7711
|
@ -345,15 +345,27 @@ bx_param_enum_c *bx_real_sim_c::get_param_enum(const char *pname, bx_param_c *ba
|
|||
void bx_init_siminterface()
|
||||
{
|
||||
if (SIM == NULL) {
|
||||
SIM = new bx_real_sim_c();
|
||||
}
|
||||
if (siminterface_log == NULL) {
|
||||
siminterface_log = new logfunctions();
|
||||
siminterface_log->put("siminterface", "SIM");
|
||||
SIM = new bx_real_sim_c();
|
||||
}
|
||||
if (root_param == NULL) {
|
||||
root_param = new bx_list_c(NULL,
|
||||
"bochs",
|
||||
"list of top level bochs parameters"
|
||||
);
|
||||
"list of top level bochs parameters");
|
||||
}
|
||||
}
|
||||
|
||||
void bx_cleanup_siminterface()
|
||||
{
|
||||
if (siminterface_log) {
|
||||
delete siminterface_log;
|
||||
}
|
||||
if (root_param) {
|
||||
root_param->clear();
|
||||
root_param = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1073,9 +1085,9 @@ void bx_real_sim_c::init_statistics()
|
|||
|
||||
void bx_real_sim_c::cleanup_statistics()
|
||||
{
|
||||
bx_list_c *list;
|
||||
bx_list_c *list = get_statistics_root();
|
||||
|
||||
if ((list = get_statistics_root()) != NULL) {
|
||||
if (list != NULL) {
|
||||
list->clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -770,6 +770,7 @@ public:
|
|||
BOCHSAPI extern bx_simulator_interface_c *SIM;
|
||||
|
||||
extern void bx_init_siminterface();
|
||||
extern void bx_cleanup_siminterface();
|
||||
|
||||
#if defined(__WXMSW__) || defined(WIN32)
|
||||
// Just to provide HINSTANCE, etc. in files that have not included bochs.h.
|
||||
|
|
|
@ -352,6 +352,7 @@ int bxmain(void)
|
|||
#endif
|
||||
plugin_cleanup();
|
||||
BX_INSTR_EXIT_ENV();
|
||||
bx_cleanup_siminterface();
|
||||
return SIM->get_exit_code();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue