diff options
author | Jason Evans <jasone@canonware.com> | 2016-10-28 18:23:24 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-10-28 18:23:24 (GMT) |
commit | bde815dc40c636523382912ecba443cc50b0eccd (patch) | |
tree | 772c0e9a41bc9314d8bf5cefbd52a180b037bc99 /test/integration | |
parent | 970d29325770a5006dc227f30481024c8661df51 (diff) | |
download | jemalloc-bde815dc40c636523382912ecba443cc50b0eccd.zip jemalloc-bde815dc40c636523382912ecba443cc50b0eccd.tar.gz jemalloc-bde815dc40c636523382912ecba443cc50b0eccd.tar.bz2 |
Reduce memory requirements for regression tests.
This is intended to drop memory usage to a level that AppVeyor test
instances can handle.
This resolves #393.
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/aligned_alloc.c | 23 | ||||
-rw-r--r-- | test/integration/mallocx.c | 44 | ||||
-rw-r--r-- | test/integration/posix_memalign.c | 23 |
3 files changed, 55 insertions, 35 deletions
diff --git a/test/integration/aligned_alloc.c b/test/integration/aligned_alloc.c index 3f1c67a..36fb699 100644 --- a/test/integration/aligned_alloc.c +++ b/test/integration/aligned_alloc.c @@ -1,6 +1,19 @@ #include "test/jemalloc_test.h" -#define MAXALIGN (((size_t)1) << 25) +#define MAXALIGN (((size_t)1) << 23) + +/* + * On systems which can't merge extents, tests that call this function generate + * a lot of dirty memory very quickly. Purging between cycles mitigates + * potential OOM on e.g. 32-bit Windows. + */ +static void +purge(void) +{ + + assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0, + "Unexpected mallctl error"); +} TEST_BEGIN(test_alignment_errors) { @@ -108,13 +121,7 @@ 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"); + purge(); } #undef NITER } diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c index 3b8097e..2298f72 100644 --- a/test/integration/mallocx.c +++ b/test/integration/mallocx.c @@ -50,6 +50,19 @@ get_large_size(size_t ind) return (get_size_impl("arenas.lextent.0.size", ind)); } +/* + * On systems which can't merge extents, tests that call this function generate + * a lot of dirty memory very quickly. Purging between cycles mitigates + * potential OOM on e.g. 32-bit Windows. + */ +static void +purge(void) +{ + + assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0, + "Unexpected mallctl error"); +} + TEST_BEGIN(test_overflow) { size_t largemax; @@ -96,6 +109,7 @@ TEST_BEGIN(test_oom) if (ptrs[i] != NULL) dallocx(ptrs[i], 0); } + purge(); #if LG_SIZEOF_PTR == 3 assert_ptr_null(mallocx(0x8000000000000000ULL, @@ -113,7 +127,7 @@ TEST_END TEST_BEGIN(test_basic) { -#define MAXSZ (((size_t)1) << 26) +#define MAXSZ (((size_t)1) << 23) size_t sz; for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) { @@ -122,30 +136,28 @@ TEST_BEGIN(test_basic) nsz = nallocx(sz, 0); assert_zu_ne(nsz, 0, "Unexpected nallocx() error"); p = mallocx(sz, 0); - assert_ptr_not_null(p, "Unexpected mallocx() error"); + assert_ptr_not_null(p, + "Unexpected mallocx(size=%zx, flags=0) error", sz); rsz = sallocx(p, 0); assert_zu_ge(rsz, sz, "Real size smaller than expected"); assert_zu_eq(nsz, rsz, "nallocx()/sallocx() size mismatch"); dallocx(p, 0); p = mallocx(sz, 0); - assert_ptr_not_null(p, "Unexpected mallocx() error"); + assert_ptr_not_null(p, + "Unexpected mallocx(size=%zx, flags=0) error", sz); dallocx(p, 0); nsz = nallocx(sz, MALLOCX_ZERO); assert_zu_ne(nsz, 0, "Unexpected nallocx() error"); p = mallocx(sz, MALLOCX_ZERO); - assert_ptr_not_null(p, "Unexpected mallocx() error"); + assert_ptr_not_null(p, + "Unexpected mallocx(size=%zx, flags=MALLOCX_ZERO) error", + nsz); rsz = sallocx(p, 0); assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch"); dallocx(p, 0); - /* - * 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"); + purge(); } #undef MAXSZ } @@ -153,7 +165,7 @@ TEST_END TEST_BEGIN(test_alignment_and_size) { -#define MAXALIGN (((size_t)1) << 25) +#define MAXALIGN (((size_t)1) << 23) #define NITER 4 size_t nsz, rsz, sz, alignment, total; unsigned i; @@ -203,13 +215,7 @@ 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"); + purge(); } #undef MAXALIGN #undef NITER diff --git a/test/integration/posix_memalign.c b/test/integration/posix_memalign.c index a64886d..9f3156a 100644 --- a/test/integration/posix_memalign.c +++ b/test/integration/posix_memalign.c @@ -1,6 +1,19 @@ #include "test/jemalloc_test.h" -#define MAXALIGN (((size_t)1) << 25) +#define MAXALIGN (((size_t)1) << 23) + +/* + * On systems which can't merge extents, tests that call this function generate + * a lot of dirty memory very quickly. Purging between cycles mitigates + * potential OOM on e.g. 32-bit Windows. + */ +static void +purge(void) +{ + + assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0, + "Unexpected mallctl error"); +} TEST_BEGIN(test_alignment_errors) { @@ -102,13 +115,7 @@ 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"); + purge(); } #undef NITER } |