Glibc provides a hook that tools such as valgrind and sanitizers can call to release "still reachable" memory that is in use at program exit. We should do the same, so that the emergency EH pool can be freed, and people will stop reporting "still reachable" memory as a leak in libstdc++. It won't be possible to backport a new global symbol to gcc-5-branch unless we do it before the gcc 6 release, using libstdc++.so.6.0.22 for gcc 5.4, and then using libstdc++.so.6.0.23 for gcc 6. To avoid exporting a new global symbol in gcc-5-branch it could be put in a special section, which would allow valgrind to find it without going through the symbol table. (We'd probably still want a global symbol for future releases, so that other tools can call it the obvious way).
See also this valgrind bug: https://bugs.kde.org/show_bug.cgi?id=345307
but as the allocator lives in libsupc++ which is static only we can add that symbol there (unversioned)?
libsupc++ is linked into libstdc++.so.6.
On Thu, 25 Feb 2016, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69945 > > --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > libsupc++ is linked into libstdc++.so.6. But the hook could be unversioned? AFAIK it is going to be used via dlsym only?
Unversioned symbols in otherwise versioned shared library? On some systems impossible, on others possible through ugly hacks. IMHO we don't want that.
Author: redi Date: Thu Mar 24 18:13:40 2016 New Revision: 234465 URL: https://gcc.gnu.org/viewcvs?rev=234465&root=gcc&view=rev Log: libstdc++/69945 Add __gnu_cxx::__freeres hook PR libstdc++/69945 * config/abi/pre/gnu.ver: Add new symbol. * libsupc++/eh_alloc.cc (__gnu_cxx::__freeres): Define. * testsuite/18_support/free_eh_pool.cc: New test. Added: trunk/libstdc++-v3/testsuite/18_support/free_eh_pool.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/config/abi/pre/gnu.ver trunk/libstdc++-v3/libsupc++/eh_alloc.cc
Implemented for GCC 6, I'm not hearing demand to backport to GCC 5. Please reopen the bug if it's needed and we can make it work without exporting the new symbol.