summaryrefslogtreecommitdiff
path: root/lib/asn1
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2022-10-26 09:34:41 +0200
committerBjörn Gustavsson <bjorn@erlang.org>2022-10-28 13:31:29 +0200
commit8cb8d3d5d6ec15c4e8f27366b72baffde39485f3 (patch)
tree75dfda12461de6e2453ca789e34ed882be653312 /lib/asn1
parenta1717af197bc01663d85e9eecef41f4bcea77248 (diff)
downloaderlang-8cb8d3d5d6ec15c4e8f27366b72baffde39485f3.tar.gz
asn1, compiler: Avoid running out of memory on Windows
If a test machine has many CPU cores but is running the 32-bit version of Windows, some of the memory-intensive tests such a compile_SUITE:core_roundtrip/1 can easily run out of memory if all cores are used. Avoid this by limiting the number of parallel processes started by asn1_test_lib:p_run/2 and test_lib:p_run/2.
Diffstat (limited to 'lib/asn1')
-rw-r--r--lib/asn1/test/asn1_test_lib.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl
index 0a331d0dd0..d421c29dd3 100644
--- a/lib/asn1/test/asn1_test_lib.erl
+++ b/lib/asn1/test/asn1_test_lib.erl
@@ -306,7 +306,14 @@ ber_get_len(<<1:1,Octets:7,T0/binary>>) ->
%% Will fail the test case if there were any errors.
p_run(Test, List) ->
- S = erlang:system_info(schedulers),
+ %% Limit the number of parallel processes to avoid running out of
+ %% memory.
+ S = case {erlang:system_info(schedulers),erlang:system_info(wordsize)} of
+ {S0,4} ->
+ min(S0, 2);
+ {S0,_} ->
+ min(S0, 8)
+ end,
N = case test_server:is_cover() of
false ->
S + 1;