Skip to content

Commit 171f24d

Browse files
KhahargoniX
andauthored
perf: upgrade to mimalloc 3 (#7786)
Co-authored-by: Henrik Böving <hargonix@gmail.com>
1 parent 062e2d4 commit 171f24d

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ if(USE_MIMALLOC)
124124
FetchContent_Declare(
125125
mimalloc
126126
GIT_REPOSITORY https://github.com/microsoft/mimalloc
127-
GIT_TAG v2.2.3
127+
GIT_BRANCH dev3
128+
GIT_TAG v3.4.1
128129
# Unnecessarily deep directory structure, but it saves us from a complicated
129130
# stage0 update for now. If we ever update the other dependencies like
130131
# cadical, it might be worth reorganizing the directory structure.

src/include/lean/lean.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ static inline lean_object * lean_alloc_small_object(unsigned sz) {
409409
lean_inc_heartbeat();
410410
#ifdef LEAN_MIMALLOC
411411
// HACK: emulate behavior of small allocator to avoid `leangz` breakage for now
412+
// NOTE: `sz` is known at compile time for most callers
412413
sz = lean_align(sz, LEAN_OBJECT_SIZE_DELTA);
413-
void * mem = mi_malloc_small(sz);
414+
void * mem = sz <= MI_SMALL_SIZE_MAX ? mi_malloc_small(sz) : mi_malloc(sz);
414415
if (mem == 0) lean_internal_panic_out_of_memory();
415416
lean_object * o = (lean_object*)mem;
416417
o->m_cs_sz = sz;

0 commit comments

Comments
 (0)