Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit de28f09

Browse files
committed
Revert to using erlang:memory() on Win32
Fixes rabbitmq/rabbitmq-server#1343
1 parent 391858b commit de28f09

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/vm_memory_monitor.erl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,10 @@ get_system_process_resident_memory({unix,openbsd}) ->
185185
get_ps_memory();
186186

187187
get_system_process_resident_memory({win32,_OSname}) ->
188-
OsPid = os:getpid(),
189-
Cmd = "wmic process where processid=" ++ OsPid ++ " get WorkingSetSize /value 2>&1",
190-
CmdOutput = os:cmd(Cmd),
191-
%% Memory usage is displayed in bytes
192-
case re:run(CmdOutput, "WorkingSetSize=([0-9]+)", [{capture, all_but_first, binary}]) of
193-
{match, [Match]} ->
194-
{ok, binary_to_integer(Match)};
195-
_ ->
196-
{error, {unexpected_output_from_command, Cmd, CmdOutput}}
197-
end;
188+
% Note: 3.6.12 shipped with code that used wmic.exe to get the
189+
% WorkingSetSize value for the running erl.exe process.
190+
% See rabbitmq/rabbitmq-server#1343 for details
191+
{ok, erlang:memory(total)};
198192

199193
get_system_process_resident_memory({unix, sunos}) ->
200194
get_ps_memory();

0 commit comments

Comments
 (0)