Boost logo

Boost :

Subject: [boost] [Boost.Serialization] Help with PR fixing a memory leak in the current version
From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2018-06-25 07:35:56


TLDR: I would like to
be merged for the next Boost release to fix a memory leak and need
someone to review this or help getting it merge-ready.

Some time ago I made an analysis of a crash introduced in Boost 1.65.0
in the serialization part. The details are quite complicated as the
cause is static initialization/destruction order in shared libraries
which may even depend on compilers (could not confirm) or standard
libraries (dito, observed in all tested versions).
It boils down to a violation of the expected destruction order in the
case of shared libraries. I observed how 2 global instances of the same
type but from different shared libs are destroyed together although the
2nd should not yet be which causes a use-after-free from another global
The Singletons involved did have methods to detect, whether they are
active or destroyed but they were kinda optimized away in Boost 1.65
leading to a crash which makes the whole library unusable. Not
understanding the root cause of the crash lead to changing the singleton
to use dynamic allocation, but not freeing it which leads to the memory
leak that is currently in Boost.
The current state of the develop-branch changed this back to the crash
situation we had before making it unsuitable for the next release.

Another pair of eyes would be great to check the PR and get this finally

Thanks, Alex

Boost list run by bdawes at, gregod at, cpdaniel at, john at