109 lines
3.0 KiB
Diff
109 lines
3.0 KiB
Diff
|
From 2c53faf352ca7722f1a776c8c381b01da5b4fa96 Mon Sep 17 00:00:00 2001
|
||
|
From: Jason Evans <jasone@canonware.com>
|
||
|
Date: Fri, 28 Oct 2016 10:44:39 -0700
|
||
|
Subject: [PATCH] Periodically purge in memory-intensive integration tests.
|
||
|
|
||
|
This resolves #393.
|
||
|
---
|
||
|
test/integration/aligned_alloc.c | 13 ++++++++++---
|
||
|
test/integration/mallocx.c | 7 +++++++
|
||
|
test/integration/posix_memalign.c | 13 ++++++++++---
|
||
|
3 files changed, 27 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/test/integration/aligned_alloc.c b/test/integration/aligned_alloc.c
|
||
|
index 6090014..80bb38f 100644
|
||
|
--- a/test/integration/aligned_alloc.c
|
||
|
+++ b/test/integration/aligned_alloc.c
|
||
|
@@ -1,9 +1,7 @@
|
||
|
#include "test/jemalloc_test.h"
|
||
|
|
||
|
#define CHUNK 0x400000
|
||
|
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
|
||
|
-#define MAXALIGN ((size_t)0x2000000LU)
|
||
|
-#define NITER 4
|
||
|
+#define MAXALIGN (((size_t)1) << 25)
|
||
|
|
||
|
TEST_BEGIN(test_alignment_errors)
|
||
|
{
|
||
|
@@ -74,6 +72,7 @@ TEST_END
|
||
|
|
||
|
TEST_BEGIN(test_alignment_and_size)
|
||
|
{
|
||
|
+#define NITER 4
|
||
|
size_t alignment, size, total;
|
||
|
unsigned i;
|
||
|
void *ps[NITER];
|
||
|
@@ -110,7 +109,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
|
||
|
|
||
|
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
|
||
|
index 55e1a09..69ce781 100644
|
||
|
--- a/test/integration/mallocx.c
|
||
|
+++ b/test/integration/mallocx.c
|
||
|
@@ -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 NITER
|
||
|
diff --git a/test/integration/posix_memalign.c b/test/integration/posix_memalign.c
|
||
|
index 19741c6..171bcea 100644
|
||
|
--- a/test/integration/posix_memalign.c
|
||
|
+++ b/test/integration/posix_memalign.c
|
||
|
@@ -1,9 +1,7 @@
|
||
|
#include "test/jemalloc_test.h"
|
||
|
|
||
|
#define CHUNK 0x400000
|
||
|
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
|
||
|
-#define MAXALIGN ((size_t)0x2000000LU)
|
||
|
-#define NITER 4
|
||
|
+#define MAXALIGN (((size_t)1) << 25)
|
||
|
|
||
|
TEST_BEGIN(test_alignment_errors)
|
||
|
{
|
||
|
@@ -66,6 +64,7 @@ TEST_END
|
||
|
|
||
|
TEST_BEGIN(test_alignment_and_size)
|
||
|
{
|
||
|
+#define NITER 4
|
||
|
size_t alignment, size, total;
|
||
|
unsigned i;
|
||
|
int err;
|
||
|
@@ -104,7 +103,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
|
||
|
|