aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-01-08 20:14:18 +0100
committerSverker Eriksson <[email protected]>2014-01-08 20:14:18 +0100
commit2947f831d65b5bd807fa6e6f78cd2e96a7c26b35 (patch)
tree1b8ffcd67bef74e5d89af4c213b391972799baf1 /erts/emulator/test
parent99fbb7cffd40562907487278ae5f88b2e76d4923 (diff)
downloadotp-2947f831d65b5bd807fa6e6f78cd2e96a7c26b35.tar.gz
otp-2947f831d65b5bd807fa6e6f78cd2e96a7c26b35.tar.bz2
otp-2947f831d65b5bd807fa6e6f78cd2e96a7c26b35.zip
erts: Reduce heap usage for binary_SUITE:deep
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/binary_SUITE.erl31
1 files changed, 21 insertions, 10 deletions
diff --git a/erts/emulator/test/binary_SUITE.erl b/erts/emulator/test/binary_SUITE.erl
index bce4278337..53cafb3fbc 100644
--- a/erts/emulator/test/binary_SUITE.erl
+++ b/erts/emulator/test/binary_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1241,16 +1241,27 @@ bsbs_1(A) ->
Bin = binary_to_term_stress(<<131,$M,5:32,A,0,0,0,0,0>>),
BinSize = bit_size(Bin).
+%% lists:foldl(_,_,lists:seq(_,_)) with less heap consumption
+lists_foldl_seq(Fun, Acc0, N, To) when N =< To ->
+ Acc1 = Fun(N, Acc0),
+ lists_foldl_seq(Fun, Acc1, N+1, To);
+
+lists_foldl_seq(_, Acc, _, _) ->
+ Acc.
+
deep(Config) when is_list(Config) ->
- ?line deep_roundtrip(lists:foldl(fun(E, A) ->
- [E,A]
- end, [], lists:seq(1, 1000000))),
- ?line deep_roundtrip(lists:foldl(fun(E, A) ->
- {E,A}
- end, [], lists:seq(1, 1000000))),
- ?line deep_roundtrip(lists:foldl(fun(E, A) ->
- fun() -> {E,A} end
- end, [], lists:seq(1, 1000000))),
+ deep_roundtrip(lists_foldl_seq(fun(E, A) ->
+ [E,A]
+ end, [], 1, 1000000)),
+ erlang:garbage_collect(),
+ deep_roundtrip(lists_foldl_seq(fun(E, A) ->
+ {E,A}
+ end, [], 1, 1000000)),
+ erlang:garbage_collect(),
+ deep_roundtrip(lists_foldl_seq(fun(E, A) ->
+ fun() -> {E,A} end
+ end, [], 1, 1000000)),
+ erlang:garbage_collect(),
ok.
deep_roundtrip(T) ->