diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp index 432fcc3648b3fa..e61d97ab025d58 100644 --- a/be/src/common/config.cpp +++ b/be/src/common/config.cpp @@ -135,6 +135,8 @@ DEFINE_mBool(enable_query_memory_overcommit, "true"); DEFINE_mBool(disable_memory_gc, "false"); +DEFINE_mBool(enable_stacktrace_in_allocator_check_failed, "false"); + DEFINE_mInt64(large_memory_check_bytes, "2147483648"); DEFINE_mBool(enable_memory_orphan_check, "true"); diff --git a/be/src/common/config.h b/be/src/common/config.h index ad37b2b22382f6..d4996c726b5daf 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -174,11 +174,14 @@ DECLARE_mString(process_full_gc_size); // used memory and the exec_mem_limit will be canceled. // If false, cancel query when the memory used exceeds exec_mem_limit, same as before. DECLARE_mBool(enable_query_memory_overcommit); -//waibibabu + // gc will release cache, cancel task, and task will wait for gc to release memory, // default gc strategy is conservative, if you want to exclude the interference of gc, let it be true DECLARE_mBool(disable_memory_gc); +// Allocator check failed log stacktrace if not catch exception +DECLARE_mBool(enable_stacktrace_in_allocator_check_failed); + // malloc or new large memory larger than large_memory_check_bytes, default 2G, // will print a warning containing the stacktrace, but not prevent memory alloc. // If is -1, disable large memory check. diff --git a/be/src/vec/common/allocator.cpp b/be/src/vec/common/allocator.cpp index a012cdee41a59e..a5eb6445933927 100644 --- a/be/src/vec/common/allocator.cpp +++ b/be/src/vec/common/allocator.cpp @@ -89,8 +89,9 @@ void Allocator::sys_memory_check(size_t doris::thread_context()->thread_mem_tracker_mgr->last_consumer_tracker(), doris::GlobalMemoryArbitrator::process_limit_exceeded_errmsg_str()); - if (size > 1024L * 1024 * 1024 && !doris::enable_thread_catch_bad_alloc && - !doris::config::disable_memory_gc) { // 1G + if (!doris::enable_thread_catch_bad_alloc && + (size > 1024L * 1024 * 1024 || + doris::config::enable_stacktrace_in_allocator_check_failed)) { err_msg += "\nAlloc Stacktrace:\n" + doris::get_stack_trace(); }