Skip to content

Commit 56e1b53

Browse files
author
Tim Watson
committed
Backport e7f1cd7f26dd (Merge of bug25083; vm_memory_high_watermark reported incorrectly)
1 parent 8c57cfd commit 56e1b53

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/vm_memory_monitor.erl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
-record(state, {total_memory,
5151
memory_limit,
52+
memory_fraction,
5253
timeout,
5354
timer,
5455
alarmed
@@ -110,7 +111,7 @@ init([MemFraction]) ->
110111
{ok, set_mem_limits(State, MemFraction)}.
111112

112113
handle_call(get_vm_memory_high_watermark, _From, State) ->
113-
{reply, State#state.memory_limit / State#state.total_memory, State};
114+
{reply, State#state.memory_fraction, State};
114115

115116
handle_call({set_vm_memory_high_watermark, MemFraction}, _From, State) ->
116117
State1 = set_mem_limits(State, MemFraction),
@@ -171,8 +172,9 @@ set_mem_limits(State, MemFraction) ->
171172
MemLim = get_mem_limit(MemFraction, TotalMemory),
172173
error_logger:info_msg("Memory limit set to ~pMB of ~pMB total.~n",
173174
[trunc(MemLim/?ONE_MB), trunc(TotalMemory/?ONE_MB)]),
174-
internal_update(State #state { total_memory = TotalMemory,
175-
memory_limit = MemLim }).
175+
internal_update(State #state { total_memory = TotalMemory,
176+
memory_limit = MemLim,
177+
memory_fraction = MemFraction}).
176178

177179
internal_update(State = #state { memory_limit = MemLimit,
178180
alarmed = Alarmed}) ->

0 commit comments

Comments
 (0)