Commit a9721228 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Limit heap size of when running R8 / D8

Adds -Xmx1G to limit heap size to 1GB.

My local test of R8 on MonochromePublic.aab had a peak RSS
of 1.8GB with this flag and 8GB without it.

Does not seem to cause the command to run measurably slower.

I found that the r8 wrapper script in AOSP uses this same flag and
so does the Android lint wrapper script.

Bug: 1098333
Change-Id: Icca79bf6c1e9c8f003f613c178983f63cf9fbf04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2348018
Commit-Queue: Sam Maier <smaier@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarSam Maier <smaier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796806}
parent d4651571
......@@ -474,6 +474,7 @@ def _OnStaleMd5(changes, options, final_dex_inputs, dex_cmd):
def MergeDexForIncrementalInstall(r8_jar_path, src_paths, dest_dex_jar):
dex_cmd = [
build_utils.JAVA_PATH,
'-Xmx1G',
'-cp',
r8_jar_path,
'com.android.tools.r8.D8',
......@@ -510,6 +511,7 @@ def main(args):
dex_cmd = [
build_utils.JAVA_PATH,
'-Xmx1G',
'-cp',
options.r8_jar_path,
'com.android.tools.r8.D8',
......
......@@ -38,6 +38,7 @@ def DexJdkLibJar(r8_path, min_api, desugar_jdk_libs_json, desugar_jdk_libs_jar,
with build_utils.TempDir() as tmp_dir:
cmd = [
build_utils.JAVA_PATH,
'-Xmx1G',
'-cp',
r8_path,
'com.android.tools.r8.L8',
......
......@@ -56,6 +56,7 @@ def main():
args = _ParseArgs()
proguard_cmd = [
build_utils.JAVA_PATH,
'-Xmx1G',
'-cp',
args.r8_path,
'com.android.tools.r8.R8',
......
......@@ -256,6 +256,7 @@ def _OptimizeWithR8(options,
if options.disable_outlining:
cmd += [' -Dcom.android.tools.r8.disableOutlining=1']
cmd += [
'-Xmx1G',
'-cp',
options.r8_path,
'com.android.tools.r8.R8',
......
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