boostorg / stacktrace

C++ library for storing and printing backtraces.
https://boost.org/libs/stacktrace
422 stars 69 forks source link

End WinDbg session to prevent memory from leaking #124

Closed akarpovskii closed 6 months ago

akarpovskii commented 2 years ago

If BOOST_STACKTRACE_USE_WINDBG is defined, the implementation of stacktrace::to_string opens a new WinDbg session each time without ending the previous one which results in leaking memory (see #111).

This PR adds the missing EndSession call in the debugging_symbols destructor.

apolukhin commented 1 year ago

@akarpovskii , it looks like path breaks something. See https://github.com/boostorg/stacktrace/pull/130 the CI failures

The MSVC STL implementation also does not do the EndSession https://github.com/microsoft/STL/blob/main/stl/src/stacktrace.cpp

akarpovskii commented 1 year ago

@apolukhin, sorry for leaving the PR unfinished. At the time I didn't have enough expertise to figure this out, and now I don't have access to a Windows machine to finish it. I hope this pull request will serve as a foundation for future fixes.

apolukhin commented 6 months ago

Fixed in https://github.com/boostorg/stacktrace/commit/27093f24cb2ff187b179ffc561bdf0c27d7cf551 and https://github.com/boostorg/stacktrace/commit/f783534b0f22379e39597cf380f01e7199c24c29