Android: bump gradle JVM heap to 10G + cap workers to fix AAB OOM #23

Merged
such-gitea merged 1 commits from github-such-software/hash-wallet:dev into dev 2026-05-19 14:43:06 -04:00
Owner

Verbose log of yesterday's AAB build revealed:
java.lang.OutOfMemoryError: Java heap space
at java.util.zip.DeflaterOutputStream.write
at com.android.zipflinger.StreamSource.
at com.android.builder.internal.packaging.AabFlinger$writeZip$1.call

AAB packaging streams compressed native libs through ByteArrayOutputStream
buffers. With universal-bundle (all 3 ABIs in one AAB) and parallel
ForkJoinPool workers all drawing from the same 6G heap, the peak exceeds
budget mid-zip. APK build doesn't hit this because per-ABI APKs are
packaged separately, much smaller per-file working set.

Two changes:

  1. org.gradle.jvmargs: -Xmx6144M → -Xmx10240M, + MaxMetaspaceSize=1024M
    (the daemon-side metaspace also creeps up over a long build).
  2. org.gradle.workers.max=2 — fewer parallel workers = lower simultaneous
    buffer footprint. Build still parallel, just gentler peak.

Issue Number (if Applicable): Fixes #

Description

Please include a summary of the changes and which issue is fixed / feature is added.

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods
  • Manual tests in accessibility mode (TalkBack on Android) passed
Verbose log of yesterday's AAB build revealed: java.lang.OutOfMemoryError: Java heap space at java.util.zip.DeflaterOutputStream.write at com.android.zipflinger.StreamSource.<init> at com.android.builder.internal.packaging.AabFlinger$writeZip$1.call AAB packaging streams compressed native libs through ByteArrayOutputStream buffers. With universal-bundle (all 3 ABIs in one AAB) and parallel ForkJoinPool workers all drawing from the same 6G heap, the peak exceeds budget mid-zip. APK build doesn't hit this because per-ABI APKs are packaged separately, much smaller per-file working set. Two changes: 1) org.gradle.jvmargs: -Xmx6144M → -Xmx10240M, + MaxMetaspaceSize=1024M (the daemon-side metaspace also creeps up over a long build). 2) org.gradle.workers.max=2 — fewer parallel workers = lower simultaneous buffer footprint. Build still parallel, just gentler peak. Issue Number (if Applicable): Fixes # # Description Please include a summary of the changes and which issue is fixed / feature is added. # Pull Request - Checklist - [ ] Initial Manual Tests Passed - [ ] Double check modified code and verify it with the feature/task requirements - [ ] Format code - [ ] Look for code duplication - [ ] Clear naming for variables and methods - [ ] Manual tests in accessibility mode (TalkBack on Android) passed
such-gitea added 1 commit 2026-05-19 14:41:40 -04:00
Verbose log of yesterday's AAB build revealed:
  java.lang.OutOfMemoryError: Java heap space
    at java.util.zip.DeflaterOutputStream.write
    at com.android.zipflinger.StreamSource.<init>
    at com.android.builder.internal.packaging.AabFlinger$writeZip$1.call

AAB packaging streams compressed native libs through ByteArrayOutputStream
buffers. With universal-bundle (all 3 ABIs in one AAB) and parallel
ForkJoinPool workers all drawing from the same 6G heap, the peak exceeds
budget mid-zip. APK build doesn't hit this because per-ABI APKs are
packaged separately, much smaller per-file working set.

Two changes:
  1) org.gradle.jvmargs: -Xmx6144M → -Xmx10240M, + MaxMetaspaceSize=1024M
     (the daemon-side metaspace also creeps up over a long build).
  2) org.gradle.workers.max=2 — fewer parallel workers = lower simultaneous
     buffer footprint. Build still parallel, just gentler peak.
such-gitea merged commit 7b7cc1c6e3 into dev 2026-05-19 14:43:06 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Builds/hash-wallet#23