https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105240
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:3c742621ed28540cf42d4cfbc2bf03433cd26738 commit r12-8125-g3c742621ed28540cf42d4cfbc2bf03433cd26738 Author: Jonathan Wakely <jwak...@redhat.com> Date: Tue Apr 12 17:56:45 2022 +0100 libstdc++: Prefer to use mmap instead of malloc in libbacktrace As reported in PR libbacktrace/105240, libbacktrace leaks memory when using malloc for allocations. I originally thought it would be simpler to just use malloc unconditionally (because it's supported on all targets) but the leaks make that problematic. This adds libbacktrace's detection for mmap to the libstdc++ configury, so that we use mmap.c and mmapio.c when possible. This avoids the leaks seen previously, at least on linux. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Check for mmap. * config.h.in: Regenerate. * configure: Regenerate.