diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-09-24 14:41:04 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-09-24 14:41:04 +0100 |
commit | 607375dbca5148bfab0d22bb35f2f1fb78eac8d0 (patch) | |
tree | b4a69c6f019b3092957e1450ef45e662b3d876e9 | |
parent | d4e9ec7f74334732c06dd13521b0cdca06086666 (diff) | |
download | rabbitmq-server-607375dbca5148bfab0d22bb35f2f1fb78eac8d0.tar.gz |
Never display negative memory.
-rw-r--r-- | src/rabbit_vm.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl index 42b514db..5115c82e 100644 --- a/src/rabbit_vm.erl +++ b/src/rabbit_vm.erl @@ -43,6 +43,7 @@ memory() -> MgmtDbETS = ets_memory(rabbit_mgmt_db), MgmtDbProc = sup_memory(rabbit_mgmt_sup), Plugins = plugins_memory() - MgmtDbProc, + OtherProc = Processes - ConnChs - Qs - MsgIndexProc - MgmtDbProc - Plugins, [{total, Total}, {processes, Processes}, {ets, ETS}, @@ -55,8 +56,7 @@ memory() -> {connection_channel_procs, ConnChs}, {queue_procs, Qs}, {plugins, Plugins}, - {other_proc, Processes - ConnChs - Qs - MsgIndexProc - - MgmtDbProc - Plugins}, + {other_proc, erlang:max(0, OtherProc)}, %% [1] {mnesia, Mnesia}, {mgmt_db, MgmtDbETS + MgmtDbProc}, {msg_index, MsgIndexETS + MsgIndexProc}, @@ -66,6 +66,11 @@ memory() -> {atom, Atom}, {other_system, System - ETS - Atom - Bin - Code}]. +%% [1] - erlang:memory(processes) can be less than the sum of its +%% parts. Rather than display something nonsensical, just silence any +%% claims about negative memory. See +%% http://erlang.org/pipermail/erlang-questions/2012-September/069320.html + %%---------------------------------------------------------------------------- sup_memory(Sup) -> |