From 8ca8a0655e1eca7545b2ed55c6d1cfe6a568722a Mon Sep 17 00:00:00 2001 From: Kaijie Chen Date: Thu, 30 Nov 2023 15:57:15 +0800 Subject: [PATCH] [fix](memtracking) require size in Allocator::free (#27795) --- be/src/util/slice.h | 2 +- be/src/vec/common/allocator.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/be/src/util/slice.h b/be/src/util/slice.h index b9d05194d2e966..dce933e55802dc 100644 --- a/be/src/util/slice.h +++ b/be/src/util/slice.h @@ -336,7 +336,7 @@ class OwnedSlice : private Allocator { return *this; } - ~OwnedSlice() { Allocator::free(_slice.data); } + ~OwnedSlice() { Allocator::free(_slice.data, _slice.size); } const Slice& slice() const { return _slice; } diff --git a/be/src/vec/common/allocator.h b/be/src/vec/common/allocator.h index 8162c94fca283a..f805ab445a6ac6 100644 --- a/be/src/vec/common/allocator.h +++ b/be/src/vec/common/allocator.h @@ -142,9 +142,8 @@ class Allocator { } /// Free memory range. - void free(void* buf, size_t size = -1) { + void free(void* buf, size_t size) { if (use_mmap && size >= doris::config::mmap_threshold) { - DCHECK(size != -1); if (0 != munmap(buf, size)) { throw_bad_alloc(fmt::format("Allocator: Cannot munmap {}.", size)); }