From e9f3cf665199b358e79c6a3b938a5cb25a33fe46 Mon Sep 17 00:00:00 2001 From: Dmitry Novik Date: Mon, 18 Oct 2021 17:49:26 +0300 Subject: [PATCH] Fix used memory calculation --- src/Common/ProgressIndication.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Common/ProgressIndication.cpp b/src/Common/ProgressIndication.cpp index bf3397f50e1..5a3f8cfc350 100644 --- a/src/Common/ProgressIndication.cpp +++ b/src/Common/ProgressIndication.cpp @@ -121,11 +121,9 @@ ProgressIndication::MemoryUsage ProgressIndication::getMemoryUsage() const return std::accumulate(thread_data.cbegin(), thread_data.cend(), MemoryUsage{}, [](MemoryUsage const & acc, auto const & host_data) { - auto host_usage = std::accumulate(host_data.second.cbegin(), host_data.second.cend(), ZERO, - [](UInt64 memory, auto const & data) - { - return memory + data.second.memory_usage; - }); + UInt64 host_usage = 0; + if (auto it = host_data.second.find(ZERO); it != host_data.second.end()) + host_usage = it->second.memory_usage; return MemoryUsage{.total = acc.total + host_usage, .max = std::max(acc.max, host_usage)}; }); }