Add a string pool to store functions names

- Added StringView which is used as a reference to a string, but
doesn't own the string.
- Removed the old string pool in DwarfCUToModule::FilePrivate, since
it's doing string copy.
- Added a string pool in Module to store functions/inline origins'
names (mangled and demangled).
- The peak memory usage drops from 20.6 GB to 12.5 GB when disabling
inline records and drops from 36 GB to 20.3 GB when enabling inline records.

Bug: chromium:1246974, chromium:1250351
Change-Id: Ie7e9740ea10c1930a0fc58c6becaae2d718b83b8
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3189410
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2021-09-30 12:49:44 -07:00 committed by Joshua Peraza
parent d4bf038be7
commit ff5892c5da
5 changed files with 188 additions and 91 deletions

View file

@ -32,6 +32,7 @@
// module.cc: Implement google_breakpad::Module. See module.h.
#include "common/module.h"
#include "common/string_view.h"
#include <assert.h>
#include <errno.h>
@ -51,7 +52,7 @@ using std::unique_ptr;
Module::InlineOrigin* Module::InlineOriginMap::GetOrCreateInlineOrigin(
uint64_t offset,
const string& name) {
StringView name) {
uint64_t specification_offset = references_[offset];
// Find the root offset.
auto iter = references_.find(specification_offset);