aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-05-29 10:26:15 +0200
committerBjörn Gustavsson <[email protected]>2017-05-29 10:26:15 +0200
commitda1735243107a01421402b432dd921c837a41522 (patch)
tree0cc970712a7f50eb5795c2c45092d2f3abe7e151 /erts/emulator
parent0c30f046cd05d47959ece5c9efdb92eb40af36db (diff)
parent666de16fbea2e06b76e1850296ee42eda563a4c3 (diff)
downloadotp-da1735243107a01421402b432dd921c837a41522.tar.gz
otp-da1735243107a01421402b432dd921c837a41522.tar.bz2
otp-da1735243107a01421402b432dd921c837a41522.zip
Merge branch 'bjorn/cuddle-with-tests'
* bjorn/cuddle-with-tests: bs_construct_SUITE: Correct calculation of free memory
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/test/bs_construct_SUITE.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/erts/emulator/test/bs_construct_SUITE.erl b/erts/emulator/test/bs_construct_SUITE.erl
index 95042ac802..ed03284a5b 100644
--- a/erts/emulator/test/bs_construct_SUITE.erl
+++ b/erts/emulator/test/bs_construct_SUITE.erl
@@ -537,6 +537,8 @@ huge_binary(Config) when is_list(Config) ->
ct:timetrap({seconds, 60}),
16777216 = size(<<0:(id(1 bsl 26)),(-1):(id(1 bsl 26))>>),
garbage_collect(),
+ FreeMem = free_mem(),
+ io:format("Free memory (Mb): ~p\n", [FreeMem]),
{Shift,Return} = case free_mem() of
undefined ->
%% This test has to be inlined inside the case to
@@ -552,10 +554,14 @@ huge_binary(Config) when is_list(Config) ->
garbage_collect(),
id(<<0:((1 bsl 31)-1)>>),
{31,"Limit huge binaries to 256 Mb"};
- _ ->
+ Mb when Mb > 200 ->
garbage_collect(),
id(<<0:((1 bsl 30)-1)>>),
- {30,"Limit huge binary to 128 Mb"}
+ {30,"Limit huge binary to 128 Mb"};
+ _ ->
+ garbage_collect(),
+ id(<<0:((1 bsl 29)-1)>>),
+ {29,"Limit huge binary to 64 Mb"}
end,
garbage_collect(),
id(<<0:((1 bsl Shift)-1)>>),
@@ -567,13 +573,14 @@ huge_binary(Config) when is_list(Config) ->
Comment -> {comment, Comment}
end.
+%% Return the amount of free memory in Mb.
free_mem() ->
{ok,Apps} = application:ensure_all_started(os_mon),
Mem = memsup:get_system_memory_data(),
[ok = application:stop(App)||App <- Apps],
case proplists:get_value(free_memory,Mem) of
undefined -> undefined;
- Val -> Val div 1024
+ Val -> Val div (1024*1024)
end.
system_limit(Config) when is_list(Config) ->