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 | cfa205bdedd7b4bf9ce6a1314f75733f60b41042 (patch) | |
| tree | b4a69c6f019b3092957e1450ef45e662b3d876e9 /src | |
| parent | c1b26f1ec58130434c927444a7e44a92e463292a (diff) | |
| download | rabbitmq-server-git-cfa205bdedd7b4bf9ce6a1314f75733f60b41042.tar.gz | |
Never display negative memory.
Diffstat (limited to 'src')
| -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 42b514dbb2..5115c82ef4 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) -> |
