Skip to content

Commit

Permalink
8
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz committed Sep 1, 2024
1 parent 072a4db commit 1238900
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions be/src/util/byte_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ struct ByteBuffer : private Allocator<false> {
return Status::OK();
}

~ByteBuffer() {
SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(mem_tracker_);
Allocator<false>::free(ptr, capacity);
}
~ByteBuffer() { Allocator<false>::free(ptr, capacity); }

void put_bytes(const char* data, size_t size) {
memcpy(ptr + pos, data, size);
Expand All @@ -69,7 +66,11 @@ struct ByteBuffer : private Allocator<false> {
size_t capacity;

private:
ByteBuffer(size_t capacity_) : pos(0), limit(capacity_), capacity(capacity_) {
ByteBuffer(size_t capacity_)
: Allocator(doris::thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker()),
pos(0),
limit(capacity_),
capacity(capacity_) {
ptr = reinterpret_cast<char*>(Allocator<false>::alloc(capacity_));
}
};
Expand Down

0 comments on commit 1238900

Please sign in to comment.