mirror of
https://github.com/rui314/mold.git
synced 2024-10-04 16:48:04 +03:00
[ELF] Reduce memory usage a bit
This commit is contained in:
parent
86b142e555
commit
8714b78d48
@ -599,12 +599,19 @@ void ObjectFile<E>::initialize_mergeable_sections(Context<E> &ctx) {
|
||||
|
||||
template <typename E>
|
||||
void ObjectFile<E>::register_section_pieces(Context<E> &ctx) {
|
||||
for (std::unique_ptr<MergeableSection<E>> &m : mergeable_sections)
|
||||
if (m)
|
||||
for (std::unique_ptr<MergeableSection<E>> &m : mergeable_sections) {
|
||||
if (m) {
|
||||
m->fragments.reserve(m->strings.size());
|
||||
for (i64 i = 0; i < m->strings.size(); i++)
|
||||
m->fragments.push_back(m->parent->insert(m->strings[i], m->hashes[i],
|
||||
m->p2align));
|
||||
|
||||
// Shrink vectors that we will never use again to reclaim memory.
|
||||
m->strings.clear();
|
||||
m->hashes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize rel_fragments
|
||||
for (std::unique_ptr<InputSection<E>> &isec : sections) {
|
||||
if (!isec || !isec->is_alive || !(isec->shdr().sh_flags & SHF_ALLOC))
|
||||
|
Loading…
Reference in New Issue
Block a user