Periodically purge in memory-intensive integration tests.

This resolves #393.
This commit is contained in:
Jason Evans 2016-10-28 10:44:39 -07:00
parent 68e14c9884
commit 963289df13
3 changed files with 27 additions and 6 deletions

View File

@ -1,8 +1,6 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */ #define MAXALIGN (((size_t)1) << 25)
#define MAXALIGN ((size_t)0x2000000LU)
#define NITER 4
TEST_BEGIN(test_alignment_errors) TEST_BEGIN(test_alignment_errors)
{ {
@ -73,6 +71,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size) TEST_BEGIN(test_alignment_and_size)
{ {
#define NITER 4
size_t alignment, size, total; size_t alignment, size, total;
unsigned i; unsigned i;
void *ps[NITER]; void *ps[NITER];
@ -109,7 +108,15 @@ TEST_BEGIN(test_alignment_and_size)
} }
} }
} }
/*
* On systems which can't merge extents, this test generates a
* lot of dirty memory very quickly. Purge between cycles to
* avoid potential OOM on e.g. 32-bit Windows.
*/
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
"Unexpected mallctl error");
} }
#undef NITER
} }
TEST_END TEST_END

View File

@ -196,6 +196,13 @@ TEST_BEGIN(test_alignment_and_size)
} }
} }
} }
/*
* On systems which can't merge extents, this test generates a
* lot of dirty memory very quickly. Purge between cycles to
* avoid potential OOM on e.g. 32-bit Windows.
*/
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
"Unexpected mallctl error");
} }
#undef MAXALIGN #undef MAXALIGN
#undef NITER #undef NITER

View File

@ -1,8 +1,6 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */ #define MAXALIGN (((size_t)1) << 25)
#define MAXALIGN ((size_t)0x2000000LU)
#define NITER 4
TEST_BEGIN(test_alignment_errors) TEST_BEGIN(test_alignment_errors)
{ {
@ -65,6 +63,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size) TEST_BEGIN(test_alignment_and_size)
{ {
#define NITER 4
size_t alignment, size, total; size_t alignment, size, total;
unsigned i; unsigned i;
int err; int err;
@ -103,7 +102,15 @@ TEST_BEGIN(test_alignment_and_size)
} }
} }
} }
/*
* On systems which can't merge extents, this test generates a
* lot of dirty memory very quickly. Purge between cycles to
* avoid potential OOM on e.g. 32-bit Windows.
*/
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
"Unexpected mallctl error");
} }
#undef NITER
} }
TEST_END TEST_END