[libbacktrace] Reduce memory usage in build_address_map
authorTom de Vries <tdevries@suse.de>
Fri, 28 Dec 2018 03:43:56 +0000 (03:43 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Fri, 28 Dec 2018 03:43:56 +0000 (03:43 +0000)
commiteb33bf0a0a4914eb2a88614cf4041069843018d6
treeeed07881def123f46b43c853f4f33d03c6a06f79
parentd9aa0961ea1b37aa2159761b147e9668422925ba
[libbacktrace] Reduce memory usage in build_address_map

In build_address_map we allocate a unit, and then look for addresses in the
unit, which we store in the addrs vector, with the elements pointing to the
unit.  However, if we cannot find addresses in the unit, the allocated unit is
not used.

Fix this by detecting if the allocated unit has been used, and reusing it
otherwise.

Bootstrapped and reg-tested on x86_64.

2018-12-28  Tom de Vries  <tdevries@suse.de>

* dwarf.c (build_address_map): Reuse unused units.

From-SVN: r267445
libbacktrace/ChangeLog
libbacktrace/dwarf.c