From e7fe3fb5868c85c2ef6be89bcf32579886fadcd1 Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Wed, 16 Feb 2022 22:52:30 -0500 Subject: [PATCH] Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash --- src/gc-alloc-profiler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gc-alloc-profiler.cpp b/src/gc-alloc-profiler.cpp index 12a88c9ec5b8f..3ad55e80e9eac 100644 --- a/src/gc-alloc-profiler.cpp +++ b/src/gc-alloc-profiler.cpp @@ -54,6 +54,9 @@ jl_raw_backtrace_t get_raw_backtrace() JL_NOTSAFEPOINT { // per-thread backtrace buffer. jl_ptls_t ptls = jl_current_task->ptls; jl_bt_element_t *shared_bt_data_buffer = ptls->profiling_bt_buffer; + if (shared_bt_data_buffer == NULL) + ptls->profiling_bt_buffer = shared_bt_data_buffer = \ + malloc_s(sizeof(jl_bt_element_t) * (JL_MAX_BT_SIZE + 1)); size_t bt_size = rec_backtrace(shared_bt_data_buffer, JL_MAX_BT_SIZE, 2);