forked from OSchip/llvm-project
[ELF] --gdb-index: fix memory usage regression after D74773
On an internal target, * Before D74773: time -f '%M' => 18275680 * After D74773: time -f '%M' => 22088964 This patch restores to the status before D74773.
This commit is contained in:
parent
af7fc8c1bb
commit
0bb362c164
|
|
@ -2822,14 +2822,16 @@ template <class ELFT> GdbIndexSection *GdbIndexSection::create() {
|
|||
std::vector<std::vector<NameAttrEntry>> nameAttrs(sections.size());
|
||||
|
||||
parallelForEachN(0, sections.size(), [&](size_t i) {
|
||||
DWARFContext *dwarf =
|
||||
sections[i]->getFile<ELFT>()->getDwarf()->getContext();
|
||||
// To keep memory usage low, we don't want to keep cached DWARFContext, so
|
||||
// avoid getDwarf() here.
|
||||
ObjFile<ELFT> *file = sections[i]->getFile<ELFT>();
|
||||
DWARFContext dwarf(std::make_unique<LLDDwarfObj<ELFT>>(file));
|
||||
|
||||
chunks[i].sec = sections[i];
|
||||
chunks[i].compilationUnits = readCuList(*dwarf);
|
||||
chunks[i].addressAreas = readAddressAreas(*dwarf, sections[i]);
|
||||
chunks[i].compilationUnits = readCuList(dwarf);
|
||||
chunks[i].addressAreas = readAddressAreas(dwarf, sections[i]);
|
||||
nameAttrs[i] = readPubNamesAndTypes<ELFT>(
|
||||
static_cast<const LLDDwarfObj<ELFT> &>(dwarf->getDWARFObj()),
|
||||
static_cast<const LLDDwarfObj<ELFT> &>(dwarf.getDWARFObj()),
|
||||
chunks[i].compilationUnits);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue