Skip to content

Commit

Permalink
Merge branch 'tomyouyou-vm_memuse' into master
Browse files Browse the repository at this point in the history
(cherry picked from commit a96f5fb)
  • Loading branch information
michaelklishin committed Jan 22, 2021
1 parent 4939261 commit dc3455b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions deps/rabbit_common/src/vm_memory_monitor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ get_memory_use(bytes) ->
end};
get_memory_use(ratio) ->
{ProcessMemory, MemoryLimit} = get_cached_process_memory_and_limit(),
case MemoryLimit > 0.0 of
true -> ProcessMemory / MemoryLimit;
false -> infinity
case MemoryLimit of
infinity -> 0.0;
Num when is_number(Num) andalso Num > 0.0 ->
ProcessMemory / MemoryLimit;
_ -> infinity
end.

%% Memory reported by erlang:memory(total) is not supposed to
Expand Down

0 comments on commit dc3455b

Please sign in to comment.