[Tarantool-patches] [PATCH] refactoring: drop excess 16Kb bss buffer

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Jan 14 01:00:50 MSK 2020


Hi! Thanks for the patch!

> diff --git a/src/lib/core/backtrace.cc b/src/lib/core/backtrace.cc
> index 77f77b05c..eabd986df 100644
> --- a/src/lib/core/backtrace.cc
> +++ b/src/lib/core/backtrace.cc
> @@ -55,8 +56,6 @@
>  
>  #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);

Perhaps it is worth increasing SMALL_STATIC_SIZE with 4096
additional bytes so as not to decrease backtrace buffer size.
Backtrace was using 4096 * 4, while SMALL_STATIC_SIZE is
4096 * 3.

On the other hand, increase of static buffer size would make
total size of BSS section even bigger than before the patch,
because the static buffer is thread local. So + 4096 for this
buffer means at least + 4096 * 3 because we have at least 3
threads.

I am ok with both options. Because I don't know whether do we
really need so big buffer for a backtrace or not.

Also Cyrill is right, it is worth adding an assertion
that static_alloc does not fail.


More information about the Tarantool-patches mailing list