summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/term_to_binary_compat.erl1
-rw-r--r--src/vm_memory_monitor.erl10
2 files changed, 4 insertions, 7 deletions
diff --git a/src/term_to_binary_compat.erl b/src/term_to_binary_compat.erl
index 13396ddacb..b5e8f72bd4 100644
--- a/src/term_to_binary_compat.erl
+++ b/src/term_to_binary_compat.erl
@@ -22,4 +22,3 @@
term_to_binary_1(Term) ->
term_to_binary(Term, [{minor_version, 1}]).
-
diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl
index f21dc91e0a..b07ff27f17 100644
--- a/src/vm_memory_monitor.erl
+++ b/src/vm_memory_monitor.erl
@@ -189,14 +189,12 @@ get_system_process_resident_memory({unix,openbsd}) ->
get_system_process_resident_memory({win32,_OSname}) ->
OsPid = os:getpid(),
- Cmd = " tasklist /fi \"pid eq " ++ OsPid ++ "\" /fo LIST 2>&1 ",
+ Cmd = "wmic process where processid=" ++ OsPid ++ " get WorkingSetSize /value 2>&1",
CmdOutput = os:cmd(Cmd),
- %% Memory usage is displayed in kilobytes
- %% with comma-separated thousands
- case re:run(CmdOutput, "Mem Usage:\\s+([0-9,]+)\\s+K", [{capture, all_but_first, list}]) of
+ %% Memory usage is displayed in bytes
+ case re:run(CmdOutput, "WorkingSetSize=([0-9]+)", [{capture, all_but_first, binary}]) of
{match, [Match]} ->
- NoCommas = [ N || N <- Match, N =/= $, ],
- {ok, list_to_integer(NoCommas) * 1024};
+ {ok, binary_to_integer(Match)};
_ ->
{error, {unexpected_output_from_command, Cmd, CmdOutput}}
end;