diff options
| author | Jason Evans <jasone@canonware.com> | 2012-05-12 00:48:33 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2012-05-12 00:48:33 (GMT) |
| commit | fc9b1dbf69f59d7ecfc4ac68da9847e017e1d046 (patch) | |
| tree | 7f843c7c51cd5df5d3be1ca48f504325f0536c0d /test/bitmap.c | |
| parent | fc1bb70e5f0d9a58b39efa39cc549b5af5104760 (diff) | |
| parent | cbb71caceb1e53d0fd21284ce298885327c211b4 (diff) | |
| download | jemalloc-3.0.0.zip jemalloc-3.0.0.tar.gz jemalloc-3.0.0.tar.bz2 | |
Merge branch 'dev'3.0.0
Conflicts:
ChangeLog
include/jemalloc/internal/chunk.h
src/chunk.c
src/huge.c
src/jemalloc.c
test/rallocm.c
Diffstat (limited to 'test/bitmap.c')
| -rw-r--r-- | test/bitmap.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/test/bitmap.c b/test/bitmap.c index adfaacf..b2cb630 100644 --- a/test/bitmap.c +++ b/test/bitmap.c @@ -1,18 +1,6 @@ #define JEMALLOC_MANGLE #include "jemalloc_test.h" -/* - * Avoid using the assert() from jemalloc_internal.h, since it requires - * internal libjemalloc functionality. - * */ -#include <assert.h> - -/* - * Directly include the bitmap code, since it isn't exposed outside - * libjemalloc. - */ -#include "../src/bitmap.c" - #if (LG_BITMAP_MAXBITS > 12) # define MAXBITS 4500 #else @@ -42,11 +30,13 @@ test_bitmap_init(void) bitmap_info_init(&binfo, i); { size_t j; - bitmap_t bitmap[bitmap_info_ngroups(&binfo)]; + bitmap_t *bitmap = malloc(sizeof(bitmap_t) * + bitmap_info_ngroups(&binfo)); bitmap_init(bitmap, &binfo); for (j = 0; j < i; j++) assert(bitmap_get(bitmap, &binfo, j) == false); + free(bitmap); } } @@ -62,12 +52,14 @@ test_bitmap_set(void) bitmap_info_init(&binfo, i); { size_t j; - bitmap_t bitmap[bitmap_info_ngroups(&binfo)]; + bitmap_t *bitmap = malloc(sizeof(bitmap_t) * + bitmap_info_ngroups(&binfo)); bitmap_init(bitmap, &binfo); for (j = 0; j < i; j++) bitmap_set(bitmap, &binfo, j); assert(bitmap_full(bitmap, &binfo)); + free(bitmap); } } } @@ -82,7 +74,8 @@ test_bitmap_unset(void) bitmap_info_init(&binfo, i); { size_t j; - bitmap_t bitmap[bitmap_info_ngroups(&binfo)]; + bitmap_t *bitmap = malloc(sizeof(bitmap_t) * + bitmap_info_ngroups(&binfo)); bitmap_init(bitmap, &binfo); for (j = 0; j < i; j++) @@ -93,6 +86,7 @@ test_bitmap_unset(void) for (j = 0; j < i; j++) bitmap_set(bitmap, &binfo, j); assert(bitmap_full(bitmap, &binfo)); + free(bitmap); } } } @@ -107,7 +101,8 @@ test_bitmap_sfu(void) bitmap_info_init(&binfo, i); { ssize_t j; - bitmap_t bitmap[bitmap_info_ngroups(&binfo)]; + bitmap_t *bitmap = malloc(sizeof(bitmap_t) * + bitmap_info_ngroups(&binfo)); bitmap_init(bitmap, &binfo); /* Iteratively set bits starting at the beginning. */ @@ -137,6 +132,7 @@ test_bitmap_sfu(void) } assert(bitmap_sfu(bitmap, &binfo) == i - 1); assert(bitmap_full(bitmap, &binfo)); + free(bitmap); } } } @@ -144,7 +140,7 @@ test_bitmap_sfu(void) int main(void) { - fprintf(stderr, "Test begin\n"); + malloc_printf("Test begin\n"); test_bitmap_size(); test_bitmap_init(); @@ -152,6 +148,6 @@ main(void) test_bitmap_unset(); test_bitmap_sfu(); - fprintf(stderr, "Test end\n"); + malloc_printf("Test end\n"); return (0); } |
