Skip to content

Commit

Permalink
[fix](memtracking) require size in Allocator::free (apache#27795)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaijchen authored Nov 30, 2023
1 parent db8e56b commit 8ca8a06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion be/src/util/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class OwnedSlice : private Allocator<false, false, false> {
return *this;
}

~OwnedSlice() { Allocator::free(_slice.data); }
~OwnedSlice() { Allocator::free(_slice.data, _slice.size); }

const Slice& slice() const { return _slice; }

Expand Down
3 changes: 1 addition & 2 deletions be/src/vec/common/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 8ca8a06

Please sign in to comment.