mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-04 08:27:50 +00:00
12% allocated memory savings when debugging clang with DWARF in .o files by
making sure we perfectly size our vector of symbols on the symbol table. llvm-svn: 145069
This commit is contained in:
parent
8388955fd9
commit
ddfda81ab8
@ -78,6 +78,16 @@ public:
|
||||
|
||||
static void DumpSymbolHeader (Stream *s);
|
||||
|
||||
|
||||
void Finalize ()
|
||||
{
|
||||
// Shrink to fit the symbols so we don't waste memory
|
||||
if (m_symbols.capacity() > m_symbols.size())
|
||||
{
|
||||
collection new_symbols (m_symbols.begin(), m_symbols.end());
|
||||
m_symbols.swap (new_symbols);
|
||||
}
|
||||
}
|
||||
protected:
|
||||
typedef std::vector<Symbol> collection;
|
||||
typedef collection::iterator iterator;
|
||||
|
@ -320,6 +320,7 @@ ObjectFileMachO::GetSymtab()
|
||||
m_symtab_ap.reset(new Symtab(this));
|
||||
Mutex::Locker symtab_locker (m_symtab_ap->GetMutex());
|
||||
ParseSymtab (true);
|
||||
m_symtab_ap->Finalize ();
|
||||
}
|
||||
return m_symtab_ap.get();
|
||||
}
|
||||
@ -1488,6 +1489,8 @@ ObjectFileMachO::ParseSymtab (bool minimize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return symtab->GetNumSymbols();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user