mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Memory Management : Adjustment and fixes
Add release of several static singleton objects Fix several minor memory leaks
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RiaArgumentParser.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaMainTools.h"
|
||||
|
||||
#ifdef ENABLE_GRPC
|
||||
#include "RiaGrpcConsoleApplication.h"
|
||||
@@ -26,6 +27,7 @@
|
||||
#include "RiaConsoleApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#endif
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
@@ -66,8 +68,12 @@ int main( int argc, char* argv[] )
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
// Global initialization
|
||||
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
|
||||
|
||||
// Create feature manager before the application object is created
|
||||
RiaMainTools::initializeSingletons();
|
||||
|
||||
std::unique_ptr<RiaApplication> app( createApplication( argc, argv ) );
|
||||
|
||||
cvf::ProgramOptions progOpt;
|
||||
@@ -112,6 +118,9 @@ int main( int argc, char* argv[] )
|
||||
// Make sure project is closed to avoid assert and crash in destruction of widgets
|
||||
app->closeProject();
|
||||
|
||||
app.reset();
|
||||
RiaMainTools::releaseSingletonAndFactoryObjects();
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR )
|
||||
@@ -147,6 +156,9 @@ int main( int argc, char* argv[] )
|
||||
throw;
|
||||
}
|
||||
|
||||
app.reset();
|
||||
RiaMainTools::releaseSingletonAndFactoryObjects();
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user