diff --git a/src/mem/PoolChunked.cc b/src/mem/PoolChunked.cc index c397d00ffc2..50362e3db89 100644 --- a/src/mem/PoolChunked.cc +++ b/src/mem/PoolChunked.cc @@ -437,7 +437,6 @@ MemPoolChunked::getStats(Mem::PoolStats &stats) clean((time_t) 555555); /* don't want to get chunks released before reporting */ - stats.pool = this; stats.label = label; stats.meter = &meter; stats.obj_size = objectSize; diff --git a/src/mem/PoolMalloc.cc b/src/mem/PoolMalloc.cc index 7a33eab94cb..f409594c2d8 100644 --- a/src/mem/PoolMalloc.cc +++ b/src/mem/PoolMalloc.cc @@ -61,7 +61,6 @@ MemPoolMalloc::deallocate(void *obj) size_t MemPoolMalloc::getStats(Mem::PoolStats &stats) { - stats.pool = this; stats.label = label; stats.meter = &meter; stats.obj_size = objectSize; diff --git a/src/mem/Stats.cc b/src/mem/Stats.cc index 418557d0cfa..66604bd645a 100644 --- a/src/mem/Stats.cc +++ b/src/mem/Stats.cc @@ -16,11 +16,6 @@ Mem::GlobalStats(PoolStats &stats) { MemPools::GetInstance().flushMeters(); - stats.meter = &TheMeter; - stats.label = "Total"; - stats.obj_size = 1; - stats.overhead += sizeof(MemPools); - /* gather all stats for Totals */ size_t pools_inuse = 0; for (const auto pool: MemPools::GetInstance().pools) { @@ -29,5 +24,13 @@ Mem::GlobalStats(PoolStats &stats) stats.overhead += sizeof(Allocator *); } + // Reset PoolStats::meter, label, and obj_size data members after getStats() + // calls in the above loop set them. + stats.meter = &TheMeter; + stats.label = "Total"; + stats.obj_size = 1; + + stats.overhead += sizeof(MemPools); + return pools_inuse; } diff --git a/src/mem/Stats.h b/src/mem/Stats.h index a0af35e222e..fba1d290f0c 100644 --- a/src/mem/Stats.h +++ b/src/mem/Stats.h @@ -17,7 +17,6 @@ namespace Mem class PoolStats { public: - Allocator *pool = nullptr; const char *label = nullptr; PoolMeter *meter = nullptr; int obj_size = 0; diff --git a/src/mem/old_api.cc b/src/mem/old_api.cc index d6fc8058fee..7565d2c811a 100644 --- a/src/mem/old_api.cc +++ b/src/mem/old_api.cc @@ -586,7 +586,7 @@ Mem::Report(std::ostream &stream) PoolStats mp_stats; pool->getStats(mp_stats); - if (mp_stats.pool->meter.gb_allocated.count > 0) + if (pool->meter.gb_allocated.count > 0) usedPools.emplace_back(mp_stats); else ++not_used;