summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Lazu <gerhard@lazu.co.uk>2017-07-10 20:55:07 +0100
committerGerhard Lazu <gerhard@lazu.co.uk>2017-07-10 21:01:01 +0100
commit0872a15a050176ab7598bc3d1b21a2d5c5af3052 (patch)
tree52918e231118eb33190c208d73955609271b886c
parente5fea8d1735f7de245afc9132f71f94ef03b8b13 (diff)
downloadrabbitmq-server-git-0872a15a050176ab7598bc3d1b21a2d5c5af3052.tar.gz
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]
-rw-r--r--src/rabbit_vm.erl7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl
index e56516b05b..74d29f5be4 100644
--- a/src/rabbit_vm.erl
+++ b/src/rabbit_vm.erl
@@ -54,14 +54,13 @@ memory() ->
OsTotal = vm_memory_monitor:get_process_memory(),
- [{total, ErlangTotal},
- {processes, Processes},
+ [{processes, Processes},
{ets, ETS},
{atom, Atom},
{binary, Bin},
{code, Code},
{system, System}] =
- erlang:memory([total, processes, ets, atom, binary, code, system]),
+ erlang:memory([processes, ets, atom, binary, code, system]),
OtherProc = Processes
- ConnsReader - ConnsWriter - ConnsChannel - ConnsOther
@@ -97,7 +96,7 @@ memory() ->
%% System
{code, Code},
{atom, Atom},
- {other_system, System - ETS - Bin - Code - Atom + (OsTotal - ErlangTotal)},
+ {other_system, System - ETS - Bin - Code - Atom},
{total, OsTotal}
].