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

Commit 50fa0ef

Browse files
Merge pull request #222 from rabbitmq/rabbitmq-server-1343
Revert to using erlang:memory() on Win32
2 parents 391858b + a4aee05 commit 50fa0ef

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/vm_memory_monitor.erl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,12 @@ 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. Unfortunately
190+
%% even with a moderate invocation rate of 1 ops/second that uses more
191+
%% CPU resources than some Windows users are willing to tolerate.
192+
%% See rabbitmq/rabbitmq-server#1343 for details.
193+
{ok, erlang:memory(total)};
198194

199195
get_system_process_resident_memory({unix, sunos}) ->
200196
get_ps_memory();

0 commit comments

Comments
 (0)