-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak due to calling backtrace_create_state
multiple times
#118
Comments
Unfortunately, it's not a bug but a feature: stacktrace/include/boost/stacktrace/detail/libbacktrace_impls.hpp Lines 74 to 85 in 08d720a
There's some issue either with the packaged versions of libbacktrace, or some issue in the libbacktrace with some compiler flags that I failed to localize https://gcc.gnu.org/bugzilla//show_bug.cgi?id=87653 I have to add more docs and references into the sources and provide a macro to force single instance for those' who wish to take the risk |
boost::stacktrace::stacktrace() has memory leak, so use glog internal func to print stacktrace. The reason for the memory leak of boost::stacktrace is that a state is saved in the thread local of each thread but not actively released. The test found that each thread leaked about 100M after calling boost::stacktrace. refer to: boostorg/stacktrace#118 boostorg/stacktrace#111
Should that be |
Oops, thanks! |
Hello,
currently boost-stacktrace with the
backtrace
backend will call backtrace_create_state once for each thread. This creates a memory leak since each time a new thread is created, a newbacktrace_state
is allocated but it's never freed (and can't be since there's nobacktrace_destroy_state
). See e.g. https://patchwork.ozlabs.org/project/gcc/patch/3defaafeedc9fa6b42e61401d4c8c84e@starynkevitch.net/#1625428 for more discussion on this.The text was updated successfully, but these errors were encountered: