diff --git a/src/sysc/kernel/sc_simcontext.cpp b/src/sysc/kernel/sc_simcontext.cpp index cbe0ddce6..528913749 100644 --- a/src/sysc/kernel/sc_simcontext.cpp +++ b/src/sysc/kernel/sc_simcontext.cpp @@ -367,6 +367,9 @@ sc_simcontext::init() void sc_simcontext::clean() { + // remove remaining zombie processes + do_collect_processes(); + delete m_method_invoker_p; delete m_error; delete m_cor_pkg; @@ -516,14 +519,8 @@ sc_simcontext::crunch( bool once ) } } - // remove finally dead zombies: - - while( ! m_collectable->empty() ) - { - sc_process_b* del_p = m_collectable->front(); - m_collectable->pop_front(); - del_p->reference_decrement(); - } + // remove finally dead zombies: + do_collect_processes(); // UPDATE PHASE @@ -975,6 +972,15 @@ sc_simcontext::mark_to_collect_process( sc_process_b* zombie ) m_collectable->push_back( zombie ); } +void sc_simcontext::do_collect_processes() +{ + while( ! m_collectable->empty() ) + { + sc_process_b* del_p = m_collectable->front(); + m_collectable->pop_front(); + del_p->reference_decrement(); + } +} //------------------------------------------------------------------------------ //"sc_simcontext::stop" diff --git a/src/sysc/kernel/sc_simcontext.h b/src/sysc/kernel/sc_simcontext.h index 4b40e3efe..9fc12d2b3 100644 --- a/src/sysc/kernel/sc_simcontext.h +++ b/src/sysc/kernel/sc_simcontext.h @@ -332,6 +332,7 @@ class SC_API sc_simcontext void do_sc_stop_action(); void do_timestep( const sc_time& ); void mark_to_collect_process( sc_process_b* zombie_p ); + void do_collect_processes(); sc_method_handle remove_process( sc_method_handle ); sc_thread_handle remove_process( sc_thread_handle );