Skip to content

Commit 0872a15

Browse files
committed
Remove OsTotal - ErlangTotal mem calculation from other_system mem
As discussed with @michaelklishin: We discovered that `erlang:memory(system).` can be almost as large as OsTotal when swapping is in effect. This means that total (processes + system) will be larger than the OsTotal, therefore OsTotal - ErlangTotal cannot be assumed to be non-negative. I think having some "unaccounted" memory is better than having it "accounted" as negative. re #1223 [finishes #148435813]
1 parent e5fea8d commit 0872a15

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/rabbit_vm.erl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ memory() ->
5454
OsTotal = vm_memory_monitor:get_process_memory(),
5555

5656

57-
[{total, ErlangTotal},
58-
{processes, Processes},
57+
[{processes, Processes},
5958
{ets, ETS},
6059
{atom, Atom},
6160
{binary, Bin},
6261
{code, Code},
6362
{system, System}] =
64-
erlang:memory([total, processes, ets, atom, binary, code, system]),
63+
erlang:memory([processes, ets, atom, binary, code, system]),
6564

6665
OtherProc = Processes
6766
- ConnsReader - ConnsWriter - ConnsChannel - ConnsOther
@@ -97,7 +96,7 @@ memory() ->
9796
%% System
9897
{code, Code},
9998
{atom, Atom},
100-
{other_system, System - ETS - Bin - Code - Atom + (OsTotal - ErlangTotal)},
99+
{other_system, System - ETS - Bin - Code - Atom},
101100

102101
{total, OsTotal}
103102
].

0 commit comments

Comments
 (0)