#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
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);
}
}
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);
}
}
}
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++)
for (j = 0; j < i; j++)
bitmap_set(bitmap, &binfo, j);
assert(bitmap_full(bitmap, &binfo));
+ free(bitmap);
}
}
}
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. */
}
assert(bitmap_sfu(bitmap, &binfo) == i - 1);
assert(bitmap_full(bitmap, &binfo));
+ free(bitmap);
}
}
}
int
main(void)
{
- fprintf(stderr, "Test begin\n");
+ malloc_printf("Test begin\n");
test_bitmap_size();
test_bitmap_init();
test_bitmap_unset();
test_bitmap_sfu();
- fprintf(stderr, "Test end\n");
+ malloc_printf("Test end\n");
return (0);
}