Skip to content

Commit

Permalink
fix std malloc compile of the stress test
Browse files Browse the repository at this point in the history
  • Loading branch information
daanx committed Nov 17, 2024
1 parent 54940a6 commit c57e9b8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/test-stress.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ static int ITER = 50; // N full iterations destructing and re-creating a

#define STRESS // undefine for leak test

#ifndef NDEBUG
#define HEAP_WALK // walk the heap objects?
#endif

static bool allow_large_objects = true; // allow very large objects? (set to `true` if SCALE>100)
static size_t use_one_size = 0; // use single object size of `N * sizeof(uintptr_t)`?

Expand All @@ -66,6 +62,9 @@ static bool main_participates = false; // main thread participates as a
#define custom_calloc(n,s) mi_calloc(n,s)
#define custom_realloc(p,s) mi_realloc(p,s)
#define custom_free(p) mi_free(p)
#ifndef NDEBUG
#define HEAP_WALK // walk the heap objects?
#endif
#endif

// transfer pointer between threads
Expand Down Expand Up @@ -220,7 +219,7 @@ static void test_stress(void) {
uintptr_t r = rand();
for (int n = 0; n < ITER; n++) {
run_os_threads(THREADS, &stress);
#ifndef NDEBUG
#if !defined(NDEBUG) && !defined(USE_STD_MALLOC)
// switch between arena and OS allocation for testing
mi_option_set_enabled(mi_option_disallow_arena_alloc, (n%2)==1);
#endif
Expand Down Expand Up @@ -270,7 +269,7 @@ int main(int argc, char** argv) {
#ifdef HEAP_WALK
mi_option_enable(mi_option_visit_abandoned);
#endif
#ifndef NDEBUG
#if !defined(NDEBUG) && !defined(USE_STD_MALLOC)
mi_option_set(mi_option_arena_reserve, 32 * 1024 /* in kib = 32MiB */);
#endif
#ifndef USE_STD_MALLOC
Expand Down

0 comments on commit c57e9b8

Please sign in to comment.