From 6cd08b5fc2e2b34dba816735ae1864bf68362791 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Mon, 5 Dec 2011 14:14:12 +0100 Subject: Set absolute limit on number of threads in ethread_SUITE Win64 has no limit on number of threads, at least not one you will reach before the memory gets exhausted on a mainstream machine. Therefore the testcase max_threads has to stop at some point before we consume all virtual memory in the machine. An arbitrary limit of 80000 threads was added. --- erts/test/ethread_SUITE_data/ethread_tests.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/erts/test/ethread_SUITE_data/ethread_tests.c b/erts/test/ethread_SUITE_data/ethread_tests.c index 7e7e133d6c..ed96ecdbd2 100644 --- a/erts/test/ethread_SUITE_data/ethread_tests.c +++ b/erts/test/ethread_SUITE_data/ethread_tests.c @@ -82,6 +82,7 @@ static void print_eol(void) { fprintf(stderr, EOL); + fflush(stderr); } static void print_line(char *frmt,...) @@ -826,6 +827,7 @@ detached_thread_test(void) * Tests */ #define MTT_TIMES 10 +#define MTT_HARD_LIMIT (80000) static int mtt_terminate; static ethr_mutex mtt_mutex; @@ -866,14 +868,20 @@ mtt_create_join_threads(void) while (1) { if (ix >= no_tids) { no_tids += 100; + if (no_tids > MTT_HARD_LIMIT) { + print_line("Hit the hard limit on number of threads (%d)!", + MTT_HARD_LIMIT); + break; + } tids = (ethr_tid *) realloc((void *)tids, sizeof(ethr_tid)*no_tids); ASSERT(tids); } res = ethr_thr_create(&tids[ix], mtt_thread, NULL, NULL); - if (res != 0) + if (res != 0) { break; + } ix++; - } while (res == 0); + } no_threads = ix; -- cgit v1.2.3