diff options
author | Jason Evans <je@fb.com> | 2012-03-02 01:19:20 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2012-03-02 01:19:20 (GMT) |
commit | 0a5489e37da88a1a50fbf8552e0d3a7f8fd93ffc (patch) | |
tree | bc3ee548220bc90b98892c59dd5a5dbe546f465e /test | |
parent | 166a745b395198c2b0d661caa717e6a9400291c6 (diff) | |
download | jemalloc-0a5489e37da88a1a50fbf8552e0d3a7f8fd93ffc.zip jemalloc-0a5489e37da88a1a50fbf8552e0d3a7f8fd93ffc.tar.gz jemalloc-0a5489e37da88a1a50fbf8552e0d3a7f8fd93ffc.tar.bz2 |
Add --with-mangling.
Add the --with-mangling configure option, which can be used to specify
name mangling on a per public symbol basis that takes precedence over
--with-jemalloc-prefix.
Expose the memalign() and valloc() overrides even if
--with-jemalloc-prefix is specified. This change does no real harm, and
simplifies the code.
Diffstat (limited to 'test')
-rw-r--r-- | test/allocated.c | 26 | ||||
-rw-r--r-- | test/allocm.c | 36 | ||||
-rw-r--r-- | test/mremap.c | 3 | ||||
-rw-r--r-- | test/posix_memalign.c | 16 | ||||
-rw-r--r-- | test/rallocm.c | 20 | ||||
-rw-r--r-- | test/thread_arena.c | 13 |
6 files changed, 54 insertions, 60 deletions
diff --git a/test/allocated.c b/test/allocated.c index b1e40e4..701c175 100644 --- a/test/allocated.c +++ b/test/allocated.c @@ -20,8 +20,7 @@ thread_start(void *arg) size_t sz, usize; sz = sizeof(a0); - if ((err = JEMALLOC_P(mallctl)("thread.allocated", &a0, &sz, NULL, - 0))) { + if ((err = mallctl("thread.allocated", &a0, &sz, NULL, 0))) { if (err == ENOENT) { #ifdef JEMALLOC_STATS assert(false); @@ -33,8 +32,7 @@ thread_start(void *arg) exit(1); } sz = sizeof(ap0); - if ((err = JEMALLOC_P(mallctl)("thread.allocatedp", &ap0, &sz, NULL, - 0))) { + if ((err = mallctl("thread.allocatedp", &ap0, &sz, NULL, 0))) { if (err == ENOENT) { #ifdef JEMALLOC_STATS assert(false); @@ -48,8 +46,7 @@ thread_start(void *arg) assert(*ap0 == a0); sz = sizeof(d0); - if ((err = JEMALLOC_P(mallctl)("thread.deallocated", &d0, &sz, NULL, - 0))) { + if ((err = mallctl("thread.deallocated", &d0, &sz, NULL, 0))) { if (err == ENOENT) { #ifdef JEMALLOC_STATS assert(false); @@ -61,8 +58,7 @@ thread_start(void *arg) exit(1); } sz = sizeof(dp0); - if ((err = JEMALLOC_P(mallctl)("thread.deallocatedp", &dp0, &sz, NULL, - 0))) { + if ((err = mallctl("thread.deallocatedp", &dp0, &sz, NULL, 0))) { if (err == ENOENT) { #ifdef JEMALLOC_STATS assert(false); @@ -75,28 +71,28 @@ thread_start(void *arg) } assert(*dp0 == d0); - p = JEMALLOC_P(malloc)(1); + p = malloc(1); if (p == NULL) { fprintf(stderr, "%s(): Error in malloc()\n", __func__); exit(1); } sz = sizeof(a1); - JEMALLOC_P(mallctl)("thread.allocated", &a1, &sz, NULL, 0); + mallctl("thread.allocated", &a1, &sz, NULL, 0); sz = sizeof(ap1); - JEMALLOC_P(mallctl)("thread.allocatedp", &ap1, &sz, NULL, 0); + mallctl("thread.allocatedp", &ap1, &sz, NULL, 0); assert(*ap1 == a1); assert(ap0 == ap1); - usize = JEMALLOC_P(malloc_usable_size)(p); + usize = malloc_usable_size(p); assert(a0 + usize <= a1); - JEMALLOC_P(free)(p); + free(p); sz = sizeof(d1); - JEMALLOC_P(mallctl)("thread.deallocated", &d1, &sz, NULL, 0); + mallctl("thread.deallocated", &d1, &sz, NULL, 0); sz = sizeof(dp1); - JEMALLOC_P(mallctl)("thread.deallocatedp", &dp1, &sz, NULL, 0); + mallctl("thread.deallocatedp", &dp1, &sz, NULL, 0); assert(*dp1 == d1); assert(dp0 == dp1); diff --git a/test/allocm.c b/test/allocm.c index 762e350..151f574 100644 --- a/test/allocm.c +++ b/test/allocm.c @@ -23,13 +23,13 @@ main(void) sz = 42; nsz = 0; - r = JEMALLOC_P(nallocm)(&nsz, sz, 0); + r = nallocm(&nsz, sz, 0); if (r != ALLOCM_SUCCESS) { fprintf(stderr, "Unexpected nallocm() error\n"); abort(); } rsz = 0; - r = JEMALLOC_P(allocm)(&p, &rsz, sz, 0); + r = allocm(&p, &rsz, sz, 0); if (r != ALLOCM_SUCCESS) { fprintf(stderr, "Unexpected allocm() error\n"); abort(); @@ -38,32 +38,32 @@ main(void) fprintf(stderr, "Real size smaller than expected\n"); if (nsz != rsz) fprintf(stderr, "nallocm()/allocm() rsize mismatch\n"); - if (JEMALLOC_P(dallocm)(p, 0) != ALLOCM_SUCCESS) + if (dallocm(p, 0) != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected dallocm() error\n"); - r = JEMALLOC_P(allocm)(&p, NULL, sz, 0); + r = allocm(&p, NULL, sz, 0); if (r != ALLOCM_SUCCESS) { fprintf(stderr, "Unexpected allocm() error\n"); abort(); } - if (JEMALLOC_P(dallocm)(p, 0) != ALLOCM_SUCCESS) + if (dallocm(p, 0) != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected dallocm() error\n"); nsz = 0; - r = JEMALLOC_P(nallocm)(&nsz, sz, ALLOCM_ZERO); + r = nallocm(&nsz, sz, ALLOCM_ZERO); if (r != ALLOCM_SUCCESS) { fprintf(stderr, "Unexpected nallocm() error\n"); abort(); } rsz = 0; - r = JEMALLOC_P(allocm)(&p, &rsz, sz, ALLOCM_ZERO); + r = allocm(&p, &rsz, sz, ALLOCM_ZERO); if (r != ALLOCM_SUCCESS) { fprintf(stderr, "Unexpected allocm() error\n"); abort(); } if (nsz != rsz) fprintf(stderr, "nallocm()/allocm() rsize mismatch\n"); - if (JEMALLOC_P(dallocm)(p, 0) != ALLOCM_SUCCESS) + if (dallocm(p, 0) != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected dallocm() error\n"); #if LG_SIZEOF_PTR == 3 @@ -74,14 +74,14 @@ main(void) sz = 0x80000000LU; #endif nsz = 0; - r = JEMALLOC_P(nallocm)(&nsz, sz, ALLOCM_ALIGN(alignment)); + r = nallocm(&nsz, sz, ALLOCM_ALIGN(alignment)); if (r == ALLOCM_SUCCESS) { fprintf(stderr, "Expected error for nallocm(&nsz, %zu, 0x%x)\n", sz, ALLOCM_ALIGN(alignment)); } rsz = 0; - r = JEMALLOC_P(allocm)(&p, &rsz, sz, ALLOCM_ALIGN(alignment)); + r = allocm(&p, &rsz, sz, ALLOCM_ALIGN(alignment)); if (r == ALLOCM_SUCCESS) { fprintf(stderr, "Expected error for allocm(&p, %zu, 0x%x)\n", @@ -98,11 +98,11 @@ main(void) sz = 0x84000001LU; #endif nsz = 0; - r = JEMALLOC_P(nallocm)(&nsz, sz, ALLOCM_ALIGN(alignment)); + r = nallocm(&nsz, sz, ALLOCM_ALIGN(alignment)); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected nallocm() error\n"); rsz = 0; - r = JEMALLOC_P(allocm)(&p, &rsz, sz, ALLOCM_ALIGN(alignment)); + r = allocm(&p, &rsz, sz, ALLOCM_ALIGN(alignment)); if (r == ALLOCM_SUCCESS) { fprintf(stderr, "Expected error for allocm(&p, %zu, 0x%x)\n", @@ -116,14 +116,14 @@ main(void) sz = 0xfffffff0LU; #endif nsz = 0; - r = JEMALLOC_P(nallocm)(&nsz, sz, ALLOCM_ALIGN(alignment)); + r = nallocm(&nsz, sz, ALLOCM_ALIGN(alignment)); if (r == ALLOCM_SUCCESS) { fprintf(stderr, "Expected error for nallocm(&nsz, %zu, 0x%x)\n", sz, ALLOCM_ALIGN(alignment)); } rsz = 0; - r = JEMALLOC_P(allocm)(&p, &rsz, sz, ALLOCM_ALIGN(alignment)); + r = allocm(&p, &rsz, sz, ALLOCM_ALIGN(alignment)); if (r == ALLOCM_SUCCESS) { fprintf(stderr, "Expected error for allocm(&p, %zu, 0x%x)\n", @@ -145,7 +145,7 @@ main(void) sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) { for (i = 0; i < NITER; i++) { nsz = 0; - r = JEMALLOC_P(nallocm)(&nsz, sz, + r = nallocm(&nsz, sz, ALLOCM_ALIGN(alignment) | ALLOCM_ZERO); if (r != ALLOCM_SUCCESS) { fprintf(stderr, @@ -155,7 +155,7 @@ main(void) exit(1); } rsz = 0; - r = JEMALLOC_P(allocm)(&ps[i], &rsz, sz, + r = allocm(&ps[i], &rsz, sz, ALLOCM_ALIGN(alignment) | ALLOCM_ZERO); if (r != ALLOCM_SUCCESS) { fprintf(stderr, @@ -179,14 +179,14 @@ main(void) "%p inadequately aligned for" " alignment: %zu\n", p, alignment); } - JEMALLOC_P(sallocm)(ps[i], &rsz, 0); + sallocm(ps[i], &rsz, 0); total += rsz; if (total >= (MAXALIGN << 1)) break; } for (i = 0; i < NITER; i++) { if (ps[i] != NULL) { - JEMALLOC_P(dallocm)(ps[i], 0); + dallocm(ps[i], 0); ps[i] = NULL; } } diff --git a/test/mremap.c b/test/mremap.c index 146c66f..8d35a64 100644 --- a/test/mremap.c +++ b/test/mremap.c @@ -17,8 +17,7 @@ main(void) fprintf(stderr, "Test begin\n"); sz = sizeof(lg_chunk); - if ((err = JEMALLOC_P(mallctl)("opt.lg_chunk", &lg_chunk, &sz, NULL, - 0))) { + if ((err = mallctl("opt.lg_chunk", &lg_chunk, &sz, NULL, 0))) { assert(err != ENOENT); fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, strerror(err)); diff --git a/test/posix_memalign.c b/test/posix_memalign.c index 3e306c0..789131c 100644 --- a/test/posix_memalign.c +++ b/test/posix_memalign.c @@ -24,7 +24,7 @@ main(void) /* Test error conditions. */ for (alignment = 0; alignment < sizeof(void *); alignment++) { - err = JEMALLOC_P(posix_memalign)(&p, alignment, 1); + err = posix_memalign(&p, alignment, 1); if (err != EINVAL) { fprintf(stderr, "Expected error for invalid alignment %zu\n", @@ -34,7 +34,7 @@ main(void) for (alignment = sizeof(size_t); alignment < MAXALIGN; alignment <<= 1) { - err = JEMALLOC_P(posix_memalign)(&p, alignment + 1, 1); + err = posix_memalign(&p, alignment + 1, 1); if (err == 0) { fprintf(stderr, "Expected error for invalid alignment %zu\n", @@ -49,7 +49,7 @@ main(void) alignment = 0x80000000LU; size = 0x80000000LU; #endif - err = JEMALLOC_P(posix_memalign)(&p, alignment, size); + err = posix_memalign(&p, alignment, size); if (err == 0) { fprintf(stderr, "Expected error for posix_memalign(&p, %zu, %zu)\n", @@ -63,7 +63,7 @@ main(void) alignment = 0x40000000LU; size = 0x84000001LU; #endif - err = JEMALLOC_P(posix_memalign)(&p, alignment, size); + err = posix_memalign(&p, alignment, size); if (err == 0) { fprintf(stderr, "Expected error for posix_memalign(&p, %zu, %zu)\n", @@ -76,7 +76,7 @@ main(void) #else size = 0xfffffff0LU; #endif - err = JEMALLOC_P(posix_memalign)(&p, alignment, size); + err = posix_memalign(&p, alignment, size); if (err == 0) { fprintf(stderr, "Expected error for posix_memalign(&p, %zu, %zu)\n", @@ -95,7 +95,7 @@ main(void) size < 3 * alignment && size < (1U << 31); size += (alignment >> (LG_SIZEOF_PTR-1)) - 1) { for (i = 0; i < NITER; i++) { - err = JEMALLOC_P(posix_memalign)(&ps[i], + err = posix_memalign(&ps[i], alignment, size); if (err) { fprintf(stderr, @@ -103,13 +103,13 @@ main(void) size, size, strerror(err)); exit(1); } - total += JEMALLOC_P(malloc_usable_size)(ps[i]); + total += malloc_usable_size(ps[i]); if (total >= (MAXALIGN << 1)) break; } for (i = 0; i < NITER; i++) { if (ps[i] != NULL) { - JEMALLOC_P(free)(ps[i]); + free(ps[i]); ps[i] = NULL; } } diff --git a/test/rallocm.c b/test/rallocm.c index ccf326b..9c0df40 100644 --- a/test/rallocm.c +++ b/test/rallocm.c @@ -24,14 +24,14 @@ main(void) pagesize = (size_t)result; } - r = JEMALLOC_P(allocm)(&p, &sz, 42, 0); + r = allocm(&p, &sz, 42, 0); if (r != ALLOCM_SUCCESS) { fprintf(stderr, "Unexpected allocm() error\n"); abort(); } q = p; - r = JEMALLOC_P(rallocm)(&q, &tsz, sz, 0, ALLOCM_NO_MOVE); + r = rallocm(&q, &tsz, sz, 0, ALLOCM_NO_MOVE); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected rallocm() error\n"); if (q != p) @@ -42,7 +42,7 @@ main(void) } q = p; - r = JEMALLOC_P(rallocm)(&q, &tsz, sz, 5, ALLOCM_NO_MOVE); + r = rallocm(&q, &tsz, sz, 5, ALLOCM_NO_MOVE); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected rallocm() error\n"); if (q != p) @@ -53,7 +53,7 @@ main(void) } q = p; - r = JEMALLOC_P(rallocm)(&q, &tsz, sz + 5, 0, ALLOCM_NO_MOVE); + r = rallocm(&q, &tsz, sz + 5, 0, ALLOCM_NO_MOVE); if (r != ALLOCM_ERR_NOT_MOVED) fprintf(stderr, "Unexpected rallocm() result\n"); if (q != p) @@ -64,7 +64,7 @@ main(void) } q = p; - r = JEMALLOC_P(rallocm)(&q, &tsz, sz + 5, 0, 0); + r = rallocm(&q, &tsz, sz + 5, 0, 0); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected rallocm() error\n"); if (q == p) @@ -76,7 +76,7 @@ main(void) p = q; sz = tsz; - r = JEMALLOC_P(rallocm)(&q, &tsz, pagesize*2, 0, 0); + r = rallocm(&q, &tsz, pagesize*2, 0, 0); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected rallocm() error\n"); if (q == p) @@ -88,7 +88,7 @@ main(void) p = q; sz = tsz; - r = JEMALLOC_P(rallocm)(&q, &tsz, pagesize*4, 0, 0); + r = rallocm(&q, &tsz, pagesize*4, 0, 0); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected rallocm() error\n"); if (tsz == sz) { @@ -98,7 +98,7 @@ main(void) p = q; sz = tsz; - r = JEMALLOC_P(rallocm)(&q, &tsz, pagesize*2, 0, ALLOCM_NO_MOVE); + r = rallocm(&q, &tsz, pagesize*2, 0, ALLOCM_NO_MOVE); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected rallocm() error\n"); if (q != p) @@ -109,7 +109,7 @@ main(void) } sz = tsz; - r = JEMALLOC_P(rallocm)(&q, &tsz, pagesize*4, 0, ALLOCM_NO_MOVE); + r = rallocm(&q, &tsz, pagesize*4, 0, ALLOCM_NO_MOVE); if (r != ALLOCM_SUCCESS) fprintf(stderr, "Unexpected rallocm() error\n"); if (q != p) @@ -120,7 +120,7 @@ main(void) } sz = tsz; - JEMALLOC_P(dallocm)(p, 0); + dallocm(p, 0); fprintf(stderr, "Test end\n"); return (0); diff --git a/test/thread_arena.c b/test/thread_arena.c index ef8d681..2922d1b 100644 --- a/test/thread_arena.c +++ b/test/thread_arena.c @@ -18,22 +18,22 @@ thread_start(void *arg) size_t size; int err; - p = JEMALLOC_P(malloc)(1); + p = malloc(1); if (p == NULL) { fprintf(stderr, "%s(): Error in malloc()\n", __func__); return (void *)1; } size = sizeof(arena_ind); - if ((err = JEMALLOC_P(mallctl)("thread.arena", &arena_ind, &size, - &main_arena_ind, sizeof(main_arena_ind)))) { + if ((err = mallctl("thread.arena", &arena_ind, &size, &main_arena_ind, + sizeof(main_arena_ind)))) { fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, strerror(err)); return (void *)1; } size = sizeof(arena_ind); - if ((err = JEMALLOC_P(mallctl)("thread.arena", &arena_ind, &size, NULL, + if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) { fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, strerror(err)); @@ -57,7 +57,7 @@ main(void) fprintf(stderr, "Test begin\n"); - p = JEMALLOC_P(malloc)(1); + p = malloc(1); if (p == NULL) { fprintf(stderr, "%s(): Error in malloc()\n", __func__); ret = 1; @@ -65,8 +65,7 @@ main(void) } size = sizeof(arena_ind); - if ((err = JEMALLOC_P(mallctl)("thread.arena", &arena_ind, &size, NULL, - 0))) { + if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) { fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, strerror(err)); ret = 1; |