]>
git.saurik.com Git - redis.git/blob - deps/jemalloc/test/mremap.c
1 #define JEMALLOC_MANGLE
2 #include "jemalloc_test.h"
8 size_t sz
, lg_chunk
, chunksize
, i
;
11 malloc_printf("Test begin\n");
13 sz
= sizeof(lg_chunk
);
14 if ((err
= mallctl("opt.lg_chunk", &lg_chunk
, &sz
, NULL
, 0))) {
15 assert(err
!= ENOENT
);
16 malloc_printf("%s(): Error in mallctl(): %s\n", __func__
,
21 chunksize
= ((size_t)1U) << lg_chunk
;
23 p
= (char *)malloc(chunksize
);
25 malloc_printf("malloc(%zu) --> %p\n", chunksize
, p
);
29 memset(p
, 'a', chunksize
);
31 q
= (char *)realloc(p
, chunksize
* 2);
33 malloc_printf("realloc(%p, %zu) --> %p\n", p
, chunksize
* 2,
38 for (i
= 0; i
< chunksize
; i
++) {
44 q
= (char *)realloc(p
, chunksize
);
46 malloc_printf("realloc(%p, %zu) --> %p\n", p
, chunksize
, q
);
50 for (i
= 0; i
< chunksize
; i
++) {
58 malloc_printf("Test end\n");