Browse Source

fixing memory leaks. only log4cplus left...

tempestpy_adaptions
gereon 12 years ago
parent
commit
e802942be2
  1. 1
      src/modelChecker/EigenDtmcPrctlModelChecker.h
  2. 1
      src/modelChecker/GmmxxDtmcPrctlModelChecker.h
  3. 8
      src/mrmc.cpp
  4. 2
      src/utility/settings.cpp
  5. 6
      src/utility/settings.h

1
src/modelChecker/EigenDtmcPrctlModelChecker.h

@ -157,6 +157,7 @@ public:
// Transform the submatric matrix to the eigen format to use its solvers
Eigen::SparseMatrix<Type, 1, int_fast32_t>* eigenSubMatrix = submatrix->toEigenSparseMatrix();
delete submatrix;
// Initialize the x vector with 0.5 for each element. This is the initial guess for
// the iterative solvers. It should be safe as for all 'maybe' states we know that the

1
src/modelChecker/GmmxxDtmcPrctlModelChecker.h

@ -127,6 +127,7 @@ public:
// Transform the submatrix to the gmm++ format to use its solvers.
gmm::csr_matrix<Type>* gmmxxMatrix = submatrix->toGMMXXSparseMatrix();
delete submatrix;
// Initialize the x vector with 0.5 for each element. This is the initial guess for
// the iterative solvers. It should be safe as for all 'maybe' states we know that the

8
src/mrmc.cpp

@ -115,9 +115,10 @@ int main(const int argc, const char* argv[]) {
mrmc::formula::AP<double>* ap = new mrmc::formula::AP<double>(std::string("observe0Greater1"));
mrmc::formula::Until<double>* until = new mrmc::formula::Until<double>(trueFormula, ap);
std::vector<double>* eigenResult = NULL;
try {
eigenResult = mc.checkPathFormula(*until);
std::vector<double>* eigenResult = mc.checkPathFormula(*until);
delete eigenResult;
} catch (mrmc::exceptions::NoConvergence& nce) {
// solver did not converge
LOG4CPLUS_ERROR(logger, "EigenDtmcPrctlModelChecker did not converge with " << nce.getIterationCount() << " of max. " << nce.getMaxIterationCount() << "Iterations!");
@ -130,7 +131,8 @@ int main(const int argc, const char* argv[]) {
mrmc::formula::AP<double>* trueFormulaG = new mrmc::formula::AP<double>(std::string("true"));
mrmc::formula::AP<double>* apG = new mrmc::formula::AP<double>(std::string("observe0Greater1"));
mrmc::formula::Until<double>* untilG = new mrmc::formula::Until<double>(trueFormulaG, apG);
std::vector<double>* gmmResult = mcG.checkPathFormula(*untilG);
std::vector<double>* vec = mcG.checkPathFormula(*untilG);
delete vec;
delete untilG;
/*

2
src/utility/settings.cpp

@ -27,7 +27,7 @@ std::unique_ptr<bpo::options_description> mrmc::settings::Settings::desc = nullp
std::string mrmc::settings::Settings::binaryName = "";
mrmc::settings::Settings* mrmc::settings::Settings::inst = nullptr;
std::map< std::pair<std::string, std::string>, bpo::options_description* > mrmc::settings::Settings::modules;
std::map< std::pair<std::string, std::string>, std::shared_ptr<bpo::options_description> > mrmc::settings::Settings::modules;
/*!
* The constructor fills the option descriptions, parses the

6
src/utility/settings.h

@ -113,9 +113,9 @@ namespace settings {
// build description name
std::stringstream str;
str << T::getModuleName() << " (" << trigger.first << " = " << trigger.second << ")";
bpo::options_description* desc = new bpo::options_description(str.str());
std::shared_ptr<bpo::options_description> desc = std::shared_ptr<bpo::options_description>(new bpo::options_description(str.str()));
// but options
T::putOptions(desc);
T::putOptions(desc.get());
// store
Settings::modules[ trigger ] = desc;
}
@ -159,7 +159,7 @@ namespace settings {
/*!
* @brief Contains option descriptions for all modules.
*/
static std::map< std::pair< std::string, std::string >, bpo::options_description* > modules;
static std::map< std::pair< std::string, std::string >, std::shared_ptr<bpo::options_description> > modules;
/*!
* @brief option mapping.

Loading…
Cancel
Save