From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C41BE469719 for ; Thu, 13 Feb 2020 11:07:28 +0300 (MSK) From: Sergey Kaplun Date: Thu, 13 Feb 2020 11:06:46 +0300 Message-Id: <20200213080646.10494-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v3] refactoring: drop excess 16Kb bss buffer List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: Vladislav Shpilevoy We already have 12Kb thread-safe static buffer in `lib/small/small/static.h`, that can be used instead of 16Kb bss buffer in `src/lib/core/backtrace.cc` for backtrace payload. Closes #4650 --- branch: https://github.com/tarantool/tarantool/tree/skaplun/drop-bss-buff issue: https://github.com/tarantool/tarantool/issues/4650 src/lib/core/backtrace.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/core/backtrace.cc b/src/lib/core/backtrace.cc index 77f77b05c..b5531a596 100644 --- a/src/lib/core/backtrace.cc +++ b/src/lib/core/backtrace.cc @@ -47,16 +47,15 @@ #include #include "small/region.h" +#include "small/static.h" /* - * We use a global static buffer because it is too late to do any + * We use a static buffer interface because it is too late to do any * allocation when we are printing backtrace and fiber stack is * small. */ #define BACKTRACE_NAME_MAX 200 -static char backtrace_buf[4096 * 4]; - static __thread struct region cache_region; static __thread struct mh_i64ptr_t *proc_cache = NULL; @@ -140,8 +139,9 @@ backtrace() unw_getcontext(&unw_context); unw_cursor_t unw_cur; unw_init_local(&unw_cur, &unw_context); + char *backtrace_buf = (char *)static_alloc(SMALL_STATIC_SIZE); char *p = backtrace_buf; - char *end = p + sizeof(backtrace_buf) - 1; + char *end = p + SMALL_STATIC_SIZE - 1; int unw_status; *p = '\0'; while ((unw_status = unw_step(&unw_cur)) > 0) { -- 2.24.1