Repository: incubator-impala Updated Branches: refs/heads/master f87da848f -> 537ae013e
Remove unused MemPool::peak_allocated_bytes_ The value is not used for anything but there is code devoted to updating it and testing the value. Testing: Ran mem-pool-test to confirm it still works. Change-Id: I99eba01869914c1d1e0a6ed0cab039d904fecc02 Reviewed-on: http://gerrit.cloudera.org:8080/8114 Reviewed-by: anujphadke <[email protected]> Reviewed-by: Dan Hecht <[email protected]> Tested-by: Tim Armstrong <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/77c0e32f Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/77c0e32f Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/77c0e32f Branch: refs/heads/master Commit: 77c0e32f33f55a39387fa4b63f0a23462c805ef8 Parents: f87da84 Author: Tim Armstrong <[email protected]> Authored: Mon Sep 18 13:53:43 2017 -0700 Committer: Tim Armstrong <[email protected]> Committed: Thu Sep 21 20:48:00 2017 +0000 ---------------------------------------------------------------------- be/src/runtime/mem-pool-test.cc | 21 --------------------- be/src/runtime/mem-pool.cc | 2 -- be/src/runtime/mem-pool.h | 11 ++--------- 3 files changed, 2 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/77c0e32f/be/src/runtime/mem-pool-test.cc ---------------------------------------------------------------------- diff --git a/be/src/runtime/mem-pool-test.cc b/be/src/runtime/mem-pool-test.cc index 4f537ab..26176a5 100644 --- a/be/src/runtime/mem-pool-test.cc +++ b/be/src/runtime/mem-pool-test.cc @@ -82,41 +82,21 @@ TEST(MemPoolTest, Basic) { // size of the next allocated chunk (64K) p.Allocate(65 * 1024); EXPECT_EQ((12 + 8 + 65) * 1024, p.total_allocated_bytes()); - if (iter == 0) { - EXPECT_EQ((12 + 8 + 65) * 1024, p.peak_allocated_bytes()); - } else { - EXPECT_EQ((1 + 120 + 33) * 1024, p.peak_allocated_bytes()); - } EXPECT_EQ((16 + 32 + 65) * 1024, p.GetTotalChunkSizes()); // Clear() resets allocated data, but doesn't remove any chunks p.Clear(); EXPECT_EQ(0, p.total_allocated_bytes()); - if (iter == 0) { - EXPECT_EQ((12 + 8 + 65) * 1024, p.peak_allocated_bytes()); - } else { - EXPECT_EQ((1 + 120 + 33) * 1024, p.peak_allocated_bytes()); - } EXPECT_EQ((16 + 32 + 65) * 1024, p.GetTotalChunkSizes()); // next allocation reuses existing chunks p.Allocate(1024); EXPECT_EQ(1024, p.total_allocated_bytes()); - if (iter == 0) { - EXPECT_EQ((12 + 8 + 65) * 1024, p.peak_allocated_bytes()); - } else { - EXPECT_EQ((1 + 120 + 33) * 1024, p.peak_allocated_bytes()); - } EXPECT_EQ((16 + 32 + 65) * 1024, p.GetTotalChunkSizes()); // ... unless it doesn't fit into any available chunk p.Allocate(120 * 1024); EXPECT_EQ((1 + 120) * 1024, p.total_allocated_bytes()); - if (iter == 0) { - EXPECT_EQ((1 + 120) * 1024, p.peak_allocated_bytes()); - } else { - EXPECT_EQ((1 + 120 + 33) * 1024, p.peak_allocated_bytes()); - } EXPECT_EQ((130 + 16 + 32 + 65) * 1024, p.GetTotalChunkSizes()); // ... Try another chunk that fits into an existing chunk @@ -127,7 +107,6 @@ TEST(MemPoolTest, Basic) { // we're releasing 3 chunks, which get added to p2 p2.AcquireData(&p, false); EXPECT_EQ(0, p.total_allocated_bytes()); - EXPECT_EQ((1 + 120 + 33) * 1024, p.peak_allocated_bytes()); EXPECT_EQ(0, p.GetTotalChunkSizes()); p3.AcquireData(&p2, true); // we're keeping the 65k chunk http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/77c0e32f/be/src/runtime/mem-pool.cc ---------------------------------------------------------------------- diff --git a/be/src/runtime/mem-pool.cc b/be/src/runtime/mem-pool.cc index 1b38d37..8f58168 100644 --- a/be/src/runtime/mem-pool.cc +++ b/be/src/runtime/mem-pool.cc @@ -43,7 +43,6 @@ MemPool::MemPool(MemTracker* mem_tracker) : current_chunk_idx_(-1), next_chunk_size_(INITIAL_CHUNK_SIZE), total_allocated_bytes_(0), - peak_allocated_bytes_(0), total_reserved_bytes_(0), mem_tracker_(mem_tracker) { DCHECK(mem_tracker != NULL); @@ -217,7 +216,6 @@ void MemPool::AcquireData(MemPool* src, bool keep_current) { total_allocated_bytes_ += src->total_allocated_bytes_; src->total_allocated_bytes_ = 0; } - peak_allocated_bytes_ = std::max(total_allocated_bytes_, peak_allocated_bytes_); if (!keep_current) src->FreeAll(); DCHECK(src->CheckIntegrity(false)); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/77c0e32f/be/src/runtime/mem-pool.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/mem-pool.h b/be/src/runtime/mem-pool.h index f0393b5..648e382 100644 --- a/be/src/runtime/mem-pool.h +++ b/be/src/runtime/mem-pool.h @@ -69,8 +69,7 @@ class MemTracker; /// 28K of chunks have been allocated (chunk sizes: 4K, 8K, 16K) /// We track total and peak allocated bytes. At this point they would be the same: /// 28k bytes. A call to Clear will return the allocated memory so -/// total_allocate_bytes_ -/// becomes 0 while peak_allocate_bytes_ remains at 28k. +/// total_allocated_bytes_ becomes 0. /// p->Clear(); /// the entire 1st chunk is returned: /// .. = p->Allocate(4 * 1024); @@ -82,8 +81,7 @@ class MemTracker; /// MemPool* p2 = new MemPool(); /// the new mempool receives all chunks containing data from p /// p2->AcquireData(p, false); -/// At this point p.total_allocated_bytes_ would be 0 while p.peak_allocated_bytes_ -/// remains unchanged. +/// At this point p.total_allocated_bytes_ would be 0. /// The one remaining (empty) chunk is released: /// delete p; @@ -153,7 +151,6 @@ class MemPool { std::string DebugString(); int64_t total_allocated_bytes() const { return total_allocated_bytes_; } - int64_t peak_allocated_bytes() const { return peak_allocated_bytes_; } int64_t total_reserved_bytes() const { return total_reserved_bytes_; } MemTracker* mem_tracker() { return mem_tracker_; } @@ -208,9 +205,6 @@ class MemPool { /// sum of allocated_bytes_ int64_t total_allocated_bytes_; - /// Maximum number of bytes allocated from this pool at one time. - int64_t peak_allocated_bytes_; - /// sum of all bytes allocated in chunks_ int64_t total_reserved_bytes_; @@ -273,7 +267,6 @@ class MemPool { info.allocated_bytes += size; total_allocated_bytes_ += size; DCHECK_LE(current_chunk_idx_, chunks_.size() - 1); - peak_allocated_bytes_ = std::max(total_allocated_bytes_, peak_allocated_bytes_); return result; } };
