This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Keep GdbIndexSection::Symbols non-flattened to avoid allocating large vector
AbandonedPublic

Authored by MaskRay on Sep 17 2018, 3:08 PM.

Details

Summary

createSymbols reserved a large vector to flatten parallelly computed table chunks.
We can keep the non-flattened form to avoid the allocation.

This decreases maximum resident set size a bit (by NumSymbols*sizeof(GdbIndex),
which is ~100M for a test case that would take 21.8GiB RSS). The change
does not make code more complicated so I think it is still worthwhile.

Event Timeline

MaskRay created this revision.Sep 17 2018, 3:08 PM
MaskRay added a comment.EditedSep 17 2018, 3:15 PM

If SyntheticSection::writeTo is guaranteed to be called once (I'm not sure if that is the case), Symbols.clear() in GdbIndexSection::writeTo decreases the maximum RSS by 190MiB, but I'm not sure if it is worthy to do these (freeing resources prematurely at the end of writeTo) for GdbIndexSection and/or other sections..

ruiu added a comment.Sep 17 2018, 3:58 PM

I knew I could do this, but I chose to not do for the sake of simplicity of the code. I don't generally want to optimize code unless it is necessary. I'm working on re-commiting the patch I committed last week, which should reduce the memory consumption of this part of code significantly. I'm hoping that completely solves the issue.

MaskRay abandoned this revision.Oct 9 2018, 10:50 AM