Fix severe simulation memory leaks
This commit is contained in:
parent
b056bbd9b9
commit
f246646d7a
|
@ -705,4 +705,10 @@ void NGSPICE::validate()
|
|||
}
|
||||
|
||||
|
||||
void NGSPICE::Clean()
|
||||
{
|
||||
Command( "destroy all" );
|
||||
}
|
||||
|
||||
|
||||
bool NGSPICE::m_initialized = false;
|
||||
|
|
|
@ -97,6 +97,9 @@ public:
|
|||
///< @copydoc SPICE_SIMULATOR::GetNetlist()
|
||||
virtual const std::string GetNetlist() const override final;
|
||||
|
||||
///< @copydoc SIMULATOR::Clean()
|
||||
void Clean() override final;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
|
|
|
@ -481,6 +481,8 @@ void SIM_PLOT_FRAME::StartSimulation( const wxString& aSimCommand )
|
|||
{
|
||||
updateTuners();
|
||||
applyTuners();
|
||||
// Prevents memory leak on succeding simulations by deleting old vectors
|
||||
m_simulator->Clean();
|
||||
m_simulator->Run();
|
||||
}
|
||||
else
|
||||
|
@ -1641,6 +1643,9 @@ void SIM_PLOT_FRAME::doCloseWindow()
|
|||
if( m_simulator->IsRunning() )
|
||||
m_simulator->Stop();
|
||||
|
||||
// Prevent memory leak on exit by deleting all simulation vectors
|
||||
m_simulator->Clean();
|
||||
|
||||
// Cancel a running simProbe or simTune tool
|
||||
m_schematicFrame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
|
||||
|
||||
|
|
|
@ -99,6 +99,12 @@ public:
|
|||
*/
|
||||
virtual bool IsRunning() = 0;
|
||||
|
||||
/**
|
||||
* Cleans simulation data (i.e. all vectors)
|
||||
*
|
||||
*/
|
||||
virtual void Clean() = 0;
|
||||
|
||||
protected:
|
||||
///< Model that should be simulated.
|
||||
std::shared_ptr<SIMULATION_MODEL> m_simModel;
|
||||
|
|
Loading…
Reference in New Issue