Compare commits

...

1 Commits

Author SHA1 Message Date
Sebastian Ullrich
a4b115dab5 perf: abort on mimalloc allocation failure 2025-03-31 11:14:21 +02:00
3 changed files with 1 additions and 3 deletions

View File

@@ -353,7 +353,6 @@ static inline lean_object * lean_alloc_small_object(unsigned sz) {
// HACK: emulate behavior of small allocator to avoid `leangz` breakage for now
sz = lean_align(sz, LEAN_OBJECT_SIZE_DELTA);
void * mem = mi_malloc_small(sz);
if (mem == 0) lean_internal_panic_out_of_memory();
lean_object * o = (lean_object*)mem;
o->m_cs_sz = sz;
return o;

View File

@@ -12,7 +12,7 @@ if (USE_MIMALLOC)
# (C flags are incomplete, compile as C++ instead like everything else)
LANGUAGE CXX
# make all symbols visible, always build with optimizations as otherwise Lean becomes too slow
COMPILE_FLAGS "-DMI_SHARED_LIB -DMI_SHARED_LIB_EXPORT -O3 -DNDEBUG -DMI_WIN_NOREDIRECT")
COMPILE_FLAGS "-DMI_SHARED_LIB -DMI_SHARED_LIB_EXPORT -O3 -DNDEBUG -DMI_WIN_NOREDIRECT -DMI_XMALLOC")
endif()
add_library(leanrt_initial-exec STATIC ${RUNTIME_OBJS})

View File

@@ -298,7 +298,6 @@ extern "C" LEAN_EXPORT lean_object * lean_alloc_object(size_t sz) {
return (lean_object*)alloc(sz);
#elif defined(LEAN_MIMALLOC)
void * r = mi_malloc(sz);
if (r == nullptr) lean_internal_panic_out_of_memory();
lean_object * o = (lean_object*)r;
// not a small object
o->m_cs_sz = 0;