-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Problem: The linked-in mimalloc replaces malloc/free throughout the entire program you're running. This is an issue when catboost is dynamically loaded - e.g. via JNI.
catboost version: 1.2.2
Operating System: OSX 14.3.1 x86_64
Java version:
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7)
OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode)
The specific problem I'm running into (though it's probably more prevalent): malloc
/free
calls AFTER catboost
is loaded cause segfaults like this in the JVM:
Current thread (0x00007fbbdb009800): JavaThread "main" [_thread_in_native
, id=9987, stack(0x0000700002b47000,0x0000700002cbe000)]
Stack: [0x0000700002b47000,0x0000700002cbe000], sp=0x0000700002cbb268, f
ree space=1488k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native
code)
C [libcatboost4j-prediction10020838049295877552.dylib+0x202a61] mi_free_generic+0x91
C [libasyncProfiler.so+0x19155] std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char>>::~basic_ostringstream()+0x45
C [libasyncProfiler.so+0x18e82] Java_one_profiler_AsyncProfiler_execute0+0x5a2
You'll notice a completely unrelated library calling into mimalloc under catboost. This happens consistently - any other native code library that calls free
ends up with a similar stack trace ending in mimalloc. Would there be a way to disable mimalloc for the JNI (and maybe all shared library) builds?
aakashb-kayzen