Fix severe simulation memory leaks

This commit is contained in:
Eduardo Behr 2022-05-28 20:40:24 +00:00 committed by Mikolaj Wielgus
parent 9b15717349
commit 3e8532264e
4 changed files with 17 additions and 0 deletions

View File

@ -680,4 +680,10 @@ void NGSPICE::validate()
}
void NGSPICE::Clean()
{
Command( "destroy all" );
}
bool NGSPICE::m_initialized = false;

View File

@ -93,6 +93,9 @@ public:
///< @copydoc SPICE_SIMULATOR::GetNetlist()
virtual const std::string GetNetlist() const override;
///< @copydoc SIMULATOR::Clean()
void Clean() override final;
private:
void init();

View File

@ -480,6 +480,7 @@ void SIM_PLOT_FRAME::StartSimulation( const wxString& aSimCommand )
m_simulator->LoadNetlist( formatter.GetString() );
updateTuners();
applyTuners();
m_simulator->Clean();
m_simulator->Run();
}
@ -1649,6 +1650,8 @@ void SIM_PLOT_FRAME::doCloseWindow()
if( m_simulator->IsRunning() )
m_simulator->Stop();
m_simulator->Clean();
// Cancel a running simProbe or simTune tool
m_schematicFrame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );

View File

@ -91,6 +91,11 @@ public:
*/
virtual bool IsRunning() = 0;
/**
* Clear simulation data (i.e. all vectors).
*/
virtual void Clean() = 0;
/**
* Execute a Spice command as if it was typed into console.
*