This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ca8a0655e1 [fix](memtracking) require size in Allocator::free (#27795)
8ca8a0655e1 is described below

commit 8ca8a0655e1eca7545b2ed55c6d1cfe6a568722a
Author: Kaijie Chen <[email protected]>
AuthorDate: Thu Nov 30 15:57:15 2023 +0800

    [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 b9d05194d2e..dce933e5580 100644
--- a/be/src/util/slice.h
+++ b/be/src/util/slice.h
@@ -336,7 +336,7 @@ public:
         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 8162c94fca2..f805ab445a6 100644
--- a/be/src/vec/common/allocator.h
+++ b/be/src/vec/common/allocator.h
@@ -142,9 +142,8 @@ public:
     }
 
     /// 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));
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to