Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz committed Apr 28, 2024
1 parent 2a6f118 commit a884604
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion be/src/util/mem_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,15 @@ void MemInfo::refresh_proc_meminfo() {
}
status = CGroupUtil::find_cgroup_mem_usage(&cgroup_mem_usage);
if (status.ok() && cgroup_mem_usage > 0 && cgroup_mem_limit > 0) {
mem_available = std::min(mem_available, cgroup_mem_limit - cgroup_mem_usage);
if (mem_available < 0) {
mem_available = cgroup_mem_limit - cgroup_mem_usage;
} else {
mem_available = std::min(mem_available, cgroup_mem_limit - cgroup_mem_usage);
}
}
if (mem_available < 0) {
LOG(WARNING) << "Failed to get available memory, set MAX_INT.";
mem_available = 9223372036854775807LL;
}
if (_s_sys_mem_available.load(std::memory_order_relaxed) != mem_available) {
_s_sys_mem_available.store(mem_available);
Expand Down

0 comments on commit a884604

Please sign in to comment.