summaryrefslogtreecommitdiff
path: root/test/mremap.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2014-01-22 11:11:22 -0800
committerJason Evans <jasone@canonware.com>2014-01-22 11:11:22 -0800
commitcc47dde16203a6ae7eb685b53e1ae501f3869bc6 (patch)
tree74e81d65651b2ca7e294a857797dda6635177454 /test/mremap.c
parent0135fb806e4137dc9cdf152541926a2bc95e33f0 (diff)
parent798a48103014aabf8afb3d7efff90399a466dd8c (diff)
downloadjemalloc-3.5.0.tar.gz
Merge branch 'dev'3.5.0
Diffstat (limited to 'test/mremap.c')
-rw-r--r--test/mremap.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/test/mremap.c b/test/mremap.c
deleted file mode 100644
index 47efa7c4..00000000
--- a/test/mremap.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#define JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-int
-main(void)
-{
- int ret, err;
- size_t sz, lg_chunk, chunksize, i;
- char *p, *q;
-
- malloc_printf("Test begin\n");
-
- sz = sizeof(lg_chunk);
- if ((err = mallctl("opt.lg_chunk", &lg_chunk, &sz, NULL, 0))) {
- assert(err != ENOENT);
- malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
- strerror(err));
- ret = 1;
- goto label_return;
- }
- chunksize = ((size_t)1U) << lg_chunk;
-
- p = (char *)malloc(chunksize);
- if (p == NULL) {
- malloc_printf("malloc(%zu) --> %p\n", chunksize, p);
- ret = 1;
- goto label_return;
- }
- memset(p, 'a', chunksize);
-
- q = (char *)realloc(p, chunksize * 2);
- if (q == NULL) {
- malloc_printf("realloc(%p, %zu) --> %p\n", p, chunksize * 2,
- q);
- ret = 1;
- goto label_return;
- }
- for (i = 0; i < chunksize; i++) {
- assert(q[i] == 'a');
- }
-
- p = q;
-
- q = (char *)realloc(p, chunksize);
- if (q == NULL) {
- malloc_printf("realloc(%p, %zu) --> %p\n", p, chunksize, q);
- ret = 1;
- goto label_return;
- }
- for (i = 0; i < chunksize; i++) {
- assert(q[i] == 'a');
- }
-
- free(q);
-
- ret = 0;
-label_return:
- malloc_printf("Test end\n");
- return (ret);
-}