Make test/unit/background_thread_enable more conservative.
To avoid resource exhaustion on 32-bit platforms.
This commit is contained in:
parent
a7d73dd4c9
commit
66c889500a
@ -2,12 +2,8 @@
|
|||||||
|
|
||||||
const char *malloc_conf = "background_thread:false,narenas:1,max_background_threads:20";
|
const char *malloc_conf = "background_thread:false,narenas:1,max_background_threads:20";
|
||||||
|
|
||||||
TEST_BEGIN(test_deferred) {
|
static unsigned
|
||||||
test_skip_if(!have_background_thread);
|
max_test_narenas(void) {
|
||||||
|
|
||||||
unsigned id;
|
|
||||||
size_t sz_u = sizeof(unsigned);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 10 here is somewhat arbitrary, except insofar as we want to ensure
|
* 10 here is somewhat arbitrary, except insofar as we want to ensure
|
||||||
* that the number of background threads is smaller than the number of
|
* that the number of background threads is smaller than the number of
|
||||||
@ -15,7 +11,22 @@ TEST_BEGIN(test_deferred) {
|
|||||||
* cpu to handle background purging, so this is a conservative
|
* cpu to handle background purging, so this is a conservative
|
||||||
* approximation.
|
* approximation.
|
||||||
*/
|
*/
|
||||||
for (unsigned i = 0; i < 10 * ncpus; i++) {
|
unsigned ret = 10 * ncpus;
|
||||||
|
/* Limit the max to avoid VM exhaustion on 32-bit . */
|
||||||
|
if (ret > 512) {
|
||||||
|
ret = 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_BEGIN(test_deferred) {
|
||||||
|
test_skip_if(!have_background_thread);
|
||||||
|
|
||||||
|
unsigned id;
|
||||||
|
size_t sz_u = sizeof(unsigned);
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < max_test_narenas(); i++) {
|
||||||
expect_d_eq(mallctl("arenas.create", &id, &sz_u, NULL, 0), 0,
|
expect_d_eq(mallctl("arenas.create", &id, &sz_u, NULL, 0), 0,
|
||||||
"Failed to create arena");
|
"Failed to create arena");
|
||||||
}
|
}
|
||||||
@ -50,7 +61,7 @@ TEST_BEGIN(test_max_background_threads) {
|
|||||||
unsigned id;
|
unsigned id;
|
||||||
size_t sz_u = sizeof(unsigned);
|
size_t sz_u = sizeof(unsigned);
|
||||||
|
|
||||||
for (unsigned i = 0; i < 10 * ncpus; i++) {
|
for (unsigned i = 0; i < max_test_narenas(); i++) {
|
||||||
expect_d_eq(mallctl("arenas.create", &id, &sz_u, NULL, 0), 0,
|
expect_d_eq(mallctl("arenas.create", &id, &sz_u, NULL, 0), 0,
|
||||||
"Failed to create arena");
|
"Failed to create arena");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user