Skip to content
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 #111

Closed
ycyclop opened this issue Jun 29, 2021 · 3 comments
Closed

memory leak #111

ycyclop opened this issue Jun 29, 2021 · 3 comments

Comments

@ycyclop
Copy link

ycyclop commented Jun 29, 2021

When I do a simple stacktrace there is a memory leak that I do not expect:

int main()
{
    int counter = 0;
    while (counter < 1000)
    {
        std::cout << boost::stacktrace::stacktrace();
        counter++;
    }
}

in debug the application starts with a footprint of ~40k, at the end it raises to ~440k and as you can see all it does is call the stacktrace().
In my full application I fear it has some other impact on the memory like corruption that causes the application to misbehave after ~1000 calls but I didn't manage to reproduce it in a smaller scale. The issue I encountered is eliminated when I remove this call std::cout << boost::stacktrace::stacktrace(); in my real application.

This is on a MSVC 2019 environment. toolset v142

@correa
Copy link

correa commented Oct 25, 2021

We have also found this issue on MSVC 2019 with Boost 1.72.0

@correa
Copy link

correa commented Oct 25, 2021

Tested with Boost 1.77.0 and the leak still happens. If BOOST_STACKTRACE_USE_WINDBG_CACHED is defined then process memory usage remains stable (and the code runs much faster).

yiguolei pushed a commit to apache/doris that referenced this issue Nov 15, 2022
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
@apolukhin
Copy link
Member

apolukhin commented Feb 24, 2024

Fixed in 27093f2 and f783534

Will update the docs soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants