[llvm] [llvm-objcopy] Stream ELF output to reduce peak memory usage (PR #217706)
Jeremy T. Braun via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 10:53:48 PDT 2026
jtbraun wrote:
Thanks @fzakaria. As I recall, the max rss numbers still _look_ high here because the input is done via a `mmap` of the entire input file, and the full read at the end to copy out the data sections ends up charging the binary's peak RSS with the resulting memory taken by the page cache. The input path could be rewritten to stream as well, only holding the headers in memory, but unless you're willing to use `O_DIRECT`, the eventual `read()` syscalls populate the pagecache anyway. Unless I'm missing something, I deemed that to be not worth it. The input path may also benefit from forward-speculative reads into the page cache. (mostly assumptions, I didn't spend time verifying that)
https://github.com/llvm/llvm-project/pull/217706
More information about the llvm-commits
mailing list