From 542cb1cd8ef01169581eb2f9951ef657397ed8de Mon Sep 17 00:00:00 2001 From: PKEuS Date: Thu, 2 Oct 2014 19:40:41 +0200 Subject: [PATCH] Reduce RAM usage: Avoid keeping a copy of the preprocessed source files content during checking. --- lib/cppcheck.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 2713c30d4..820e77620 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -225,17 +225,17 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin } Timer t("Preprocessor::getcode", _settings._showtime, &S_timerResults); - const std::string codeWithoutCfg = preprocessor.getcode(filedata, cfg, filename); + std::string codeWithoutCfg = preprocessor.getcode(filedata, cfg, filename); t.Stop(); - const std::string &appendCode = _settings.append(); + codeWithoutCfg += _settings.append(); if (_settings.debugFalsePositive) { - if (findError(codeWithoutCfg + appendCode, filename.c_str())) { + if (findError(codeWithoutCfg, filename.c_str())) { return exitcode; } } else { - if (!checkFile(codeWithoutCfg + appendCode, filename.c_str(), checksums)) { + if (!checkFile(codeWithoutCfg, filename.c_str(), checksums)) { if (_settings.isEnabled("information") && (_settings.debug || _settings._verbose)) purgedConfigurationMessage(filename, cfg); }