From 2abb03b915fc1c98acf5df818c11e7ad6bdcacf7 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 4 Jan 2023 10:07:24 +0800 Subject: [PATCH] fix(core): do not use STL thread_local on Android GitOrigin-RevId: 16a631fd77c5bb051f1327166f4c6b2aef9866a2 --- src/core/include/megbrain/utils/thread_local.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/include/megbrain/utils/thread_local.h b/src/core/include/megbrain/utils/thread_local.h index fd62d1207..3b968e02b 100644 --- a/src/core/include/megbrain/utils/thread_local.h +++ b/src/core/include/megbrain/utils/thread_local.h @@ -18,6 +18,12 @@ # endif #endif +#if defined(__ANDROID__) +#pragma message("force disable USE_STL_THREAD_LOCAL for thread_local mem leak at dlopen/dlclose") +#undef USE_STL_THREAD_LOCAL +#define USE_STL_THREAD_LOCAL 0 +#endif + #if USE_STL_THREAD_LOCAL #define MGB_THREAD_LOCAL_PTR(T) thread_local T* #else -- GitLab