From e9a32b740f2e7a31bc0fff2cdc5a2c9b0b3688f7 Mon Sep 17 00:00:00 2001 From: guido Date: Mon, 8 Dec 2003 14:52:43 +0000 Subject: [PATCH] memory_consumption git-svn-id: https://svn.dealii.org/trunk@8244 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/vector_memory.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/deal.II/lac/include/lac/vector_memory.h b/deal.II/lac/include/lac/vector_memory.h index 7691c1d8e7..147f576c80 100644 --- a/deal.II/lac/include/lac/vector_memory.h +++ b/deal.II/lac/include/lac/vector_memory.h @@ -172,6 +172,13 @@ class GrowingVectorMemory : public VectorMemory */ unsigned int n_alloc; + /** + * Memory consumed by this class + * and all currently allocated + * vectors. + */ + unsigned int memory_consumption() const; + /** * Mutex to synchronise access to * internal data of this object @@ -277,4 +284,16 @@ GrowingVectorMemory::free(const VECTOR* const v) } +template +unsigned int +GrowingVectorMemory::memory_consumption () const +{ + unsigned int result = sizeof (*this); + const typename std::vector::const_iterator + end = pool.end(); + for (typename std::vector::const_iterator i = pool.begin() + ; i != end ; ++i) + result += i->memory_consumption(); +} + #endif -- 2.39.5