merge from dev

This commit is contained in:
Daan 2024-06-03 21:31:36 -07:00
commit 64f3afdda4
6 changed files with 16 additions and 9 deletions

View file

@ -258,6 +258,7 @@ if(MI_DEBUG_UBSAN)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Build with undefined-behavior sanitizer (MI_DEBUG_UBSAN=ON)")
list(APPEND mi_defines MI_UBSAN=1)
list(APPEND mi_cflags -fsanitize=undefined -g -fno-sanitize-recover=undefined)
list(APPEND mi_libraries -fsanitize=undefined)
if (NOT MI_USE_CXX)

View file

@ -112,7 +112,7 @@ jobs:
CC: clang
CXX: clang++
BuildType: debug-tsan-clang-cxx
cmakeExtraArgs: -DCMAKE_BUILD_TYPE=Debug -DMI_USE_CXX=ON -DMI_DEBUG_TSAN=ON
cmakeExtraArgs: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMI_USE_CXX=ON -DMI_DEBUG_TSAN=ON
steps:
- task: CMake@1

View file

@ -584,6 +584,7 @@ mi_decl_nodiscard void* mi_new_reallocn(void* p, size_t newcount, size_t size) {
#ifdef __cplusplus
void* _mi_externs[] = {
(void*)&_mi_page_malloc,
(void*)&_mi_page_malloc_zero,
(void*)&_mi_heap_malloc_zero,
(void*)&_mi_heap_malloc_zero_ex,
(void*)&mi_malloc,

View file

@ -13,8 +13,6 @@ terms of the MIT license. A copy of the license can be found in the file
#include "bitmap.h"
#endif
typedef struct mi_arena_s mi_arena_t;
// Minimal exports for arena-abandoned.
size_t mi_arena_id_index(mi_arena_id_t id);
mi_arena_t* mi_arena_from_index(size_t idx);

View file

@ -62,7 +62,7 @@ static mi_decl_cache_align _Atomic(mi_arena_t*) mi_arenas[MI_MAX_ARENAS];
static mi_decl_cache_align _Atomic(size_t) mi_arena_count; // = 0
#define MI_IN_ARENA_C
#include "arena-abandoned.c"
#include "arena-abandon.c"
#undef MI_IN_ARENA_C
/* -----------------------------------------------------------

View file

@ -25,14 +25,21 @@ terms of the MIT license.
// > mimalloc-test-stress [THREADS] [SCALE] [ITER]
//
// argument defaults
#if !defined(MI_TSAN)
#if defined(MI_TSAN) // with thread-sanitizer reduce the threads to test within the azure pipeline limits
static int THREADS = 8;
static int SCALE = 25;
static int ITER = 200;
#elif defined(MI_UBSAN) // with undefined behavious sanitizer reduce parameters to stay within the azure pipeline limits
static int THREADS = 8;
static int SCALE = 25;
static int ITER = 20;
#else
static int THREADS = 32; // more repeatable if THREADS <= #processors
#else // with thread-sanitizer reduce the defaults for azure pipeline limits
static int THREADS = 8;
#endif
static int SCALE = 25; // scaling factor
static int ITER = 50; // N full iterations destructing and re-creating all threads
#endif
#define STRESS // undefine for leak test