diff --git a/src/bitmap.c b/src/bitmap.c index 98b53052..01064140 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- -Copyright (c) 2019-2021 Microsoft Research, Daan Leijen +Copyright (c) 2019-2023 Microsoft Research, Daan Leijen This is free software; you can redistribute it and/or modify it under the terms of the MIT license. A copy of the license can be found in the file "LICENSE" at the root of this distribution. diff --git a/src/segment-map.c b/src/segment-map.c index 56b18531..4c2104bd 100644 --- a/src/segment-map.c +++ b/src/segment-map.c @@ -125,7 +125,7 @@ static mi_segment_t* _mi_segment_of(const void* p) { // Is this a valid pointer in our heap? static bool mi_is_valid_pointer(const void* p) { - return (_mi_segment_of(p) != NULL); + return ((_mi_segment_of(p) != NULL) || (_mi_arena_contains(p))); } mi_decl_nodiscard mi_decl_export bool mi_is_in_heap_region(const void* p) mi_attr_noexcept { diff --git a/test/test-stress.c b/test/test-stress.c index c0de8910..0d6d0bc9 100644 --- a/test/test-stress.c +++ b/test/test-stress.c @@ -38,8 +38,8 @@ static int ITER = 50; // N full iterations destructing and re-creating a #define STRESS // undefine for leak test -static bool allow_large_objects = true; // allow very large objects? -static size_t use_one_size = 0; // use single object size of `N * sizeof(uintptr_t)`? +static bool allow_large_objects = false; // 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)`? // #define USE_STD_MALLOC @@ -244,7 +244,10 @@ int main(int argc, char** argv) { long n = (strtol(argv[3], &end, 10)); if (n > 0) ITER = n; } - printf("Using %d threads with a %d%% load-per-thread and %d iterations\n", THREADS, SCALE, ITER); + if (SCALE > 100) { + allow_large_objects = true; + } + printf("Using %d threads with a %d%% load-per-thread and %d iterations %s\n", THREADS, SCALE, ITER, (allow_large_objects ? "(allow large objects)" : "")); //mi_reserve_os_memory(1024*1024*1024ULL, false, true); //int res = mi_reserve_huge_os_pages(4,1); //printf("(reserve huge: %i\n)", res);