]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Include allocated vectors in GrowingVectorMemory's memory consumption 16957/head
authorSebastian Proell <sebastian.proell@tum.de>
Fri, 3 May 2024 09:10:48 +0000 (11:10 +0200)
committerSebastian Proell <sebastian.proell@tum.de>
Fri, 3 May 2024 09:10:48 +0000 (11:10 +0200)
include/deal.II/lac/vector_memory.templates.h

index 624868e4ba4aff9fde0dd8e4a2731848785109a9..c701df6fcc1956d1d8084c182c8a92ecc9262966 100644 (file)
@@ -204,9 +204,9 @@ GrowingVectorMemory<VectorType>::memory_consumption() const
   std::lock_guard<std::mutex> lock(mutex);
 
   std::size_t result = sizeof(*this);
-  for (const entry_type &i : *get_pool().data)
-    result +=
-      sizeof(entry_type) + MemoryConsumption::memory_consumption(i.second);
+  for (const auto &[_, ptr] : *get_pool().data)
+    result += sizeof(ptr) + (ptr ? MemoryConsumption::memory_consumption(*ptr) :
+                                   MemoryConsumption::memory_consumption(ptr));
 
   return result;
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.