Skip to content

Commit 27bf1d6

Browse files
Merge pull request #1414 from rabbitmq/rabbitmq-management-499-followup
Report strategy, erlang total, rss and allocated memory
2 parents e1c92ec + 627339a commit 27bf1d6

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/rabbit_vm.erl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,11 @@ memory() ->
6161
erlang:memory([total, processes, ets, atom, binary, code, system]),
6262

6363
Strategy = vm_memory_monitor:get_memory_calculation_strategy(),
64-
{Allocated, VMTotal} = case Strategy of
65-
erlang -> {ErlangTotal, ErlangTotal};
66-
allocated ->
67-
Alloc = recon_alloc:memory(allocated),
68-
{Alloc, Alloc};
69-
rss ->
70-
Alloc = recon_alloc:memory(allocated),
71-
Vm = vm_memory_monitor:get_process_memory(current),
72-
{Alloc, Vm}
73-
end,
64+
Allocated = recon_alloc:memory(allocated),
65+
Rss = vm_memory_monitor:get_rss_memory(),
7466

7567
AllocatedUnused = max(Allocated - ErlangTotal, 0),
76-
OSReserved = max(VMTotal - Allocated, 0),
68+
OSReserved = max(Rss - Allocated, 0),
7769

7870
OtherProc = Processes
7971
- ConnsReader - ConnsWriter - ConnsChannel - ConnsOther
@@ -112,7 +104,10 @@ memory() ->
112104
{other_system, System - ETS - Bin - Code - Atom},
113105
{allocated_unused, AllocatedUnused},
114106
{reserved_unallocated, OSReserved},
115-
{total, VMTotal}
107+
{strategy, Strategy},
108+
{total, [{erlang, ErlangTotal},
109+
{rss, Rss},
110+
{allocated, Allocated}]}
116111
].
117112
%% [1] - erlang:memory(processes) can be less than the sum of its
118113
%% parts. Rather than display something nonsensical, just silence any

0 commit comments

Comments
 (0)