Commit 0e9a0b02 authored by George Burgess IV's avatar George Burgess IV Committed by Commit Bot

build: adjust ThinLTO's memory usage for non-Android

In the linked bug, we discovered that clean Chrome links with ThinLTO
enabled consume quite a bit of memory. In my measurements, Chrome OS x64
links take around 49GB, and a standard Linux ThinLTO link takes around
46GB.

Build command:
  $ /usr/bin/time -v ninja chrome
  [snip]
  Maximum resident set size (kbytes): 46337504
  [snip]
  $ cat args.gn
  target_os = "linux"
  target_cpu = "x64"
  use_goma = true
  is_official_build = true
  is_chrome_branded = true
  clang_use_default_sample_profile = true
  use_thin_lto = true

(the last two args should be redundant in this case)

Measured similarly, Android's build takes 8-9GB on ARM, so it gets to
stay at 10GB.

Bug: 988364
Change-Id: Ia1bbf6b441dcb9219a37842060e72eebe7ec687e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1755189Reviewed-by: default avatarPeter Collingbourne <pcc@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689090}
parent 4e28fcb6
...@@ -21,10 +21,15 @@ declare_args() { ...@@ -21,10 +21,15 @@ declare_args() {
if (concurrent_links == -1) { if (concurrent_links == -1) {
if (use_thin_lto) { if (use_thin_lto) {
_args = [ _args = [ "--reserve_mem_gb=10" ]
"--mem_per_link_gb=10", # On Chrome OS and Linux, ThinLTO peaks at a bit above 45GB for Chrome.
"--reserve_mem_gb=10", # Android links weigh in much smaller, at around 8-10GB of working memory
] # (measured by /usr/bin/time -v).
if (is_android) {
_args += [ "--mem_per_link_gb=10" ]
} else {
_args += [ "--mem_per_link_gb=45" ]
}
} else if (use_sanitizer_coverage || use_fuzzing_engine) { } else if (use_sanitizer_coverage || use_fuzzing_engine) {
# Sanitizer coverage instrumentation increases linker memory consumption # Sanitizer coverage instrumentation increases linker memory consumption
# significantly. # significantly.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment