Skip to content

Commit

Permalink
Add current_memory
Browse files Browse the repository at this point in the history
  • Loading branch information
loneylee committed Apr 29, 2024
1 parent 589765e commit b0c7f48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Common/CurrentMemoryTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ using DB::current_thread;
thread_local std::function<void(Int64, bool)> CurrentMemoryTracker::before_alloc = nullptr;

thread_local std::function<void(Int64)> CurrentMemoryTracker::before_free = nullptr;
thread_local std::function<Int64()> CurrentMemoryTracker::current_memory = nullptr;

AllocationTrace CurrentMemoryTracker::allocImpl(Int64 size, bool throw_if_memory_exceeded)
{
Expand Down
1 change: 1 addition & 0 deletions src/Common/CurrentMemoryTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct CurrentMemoryTracker

static thread_local std::function<void(Int64, bool)> before_alloc;
static thread_local std::function<void(Int64)> before_free;
static thread_local std::function<Int64()> current_memory;
private:
[[nodiscard]] static AllocationTrace allocImpl(Int64 size, bool throw_if_memory_exceeded);
};

0 comments on commit b0c7f48

Please sign in to comment.