Skip to content

Commit 4d76783

Browse files
authored
fix: bump metaspace limits in release Gradle config (#30093)
## **Description** Fixes Gradle daemon OOM crashes in release Android builds caused by insufficient metaspace. The [RN 0.81.5 upgrade increased metaspace](https://github.com/MetaMask/metamask-mobile/pull/29195/changes#diff-76cfa064ed35a9fdb156b8a6d74a9ad14983bf6f859c41a27ca8a4b7a32b17d7R4) in `gradle.properties.github` (E2E) but `gradle.properties.release` (production) was created before that fix and still had the old 512m limit. Changes: - `MaxMetaspaceSize` 512m -> 2g (Gradle daemon JVM args) - Add `MaxMetaspaceSize=1g` to `kotlin.daemon.jvmargs` Evidence: [build job 75442162274](https://github.com/MetaMask/metamask-mobile/actions/runs/25695060995/job/75442162274) had 2 daemon crashes with `The Daemon will expire after the build after running out of JVM Metaspace` at 512m. E2E builds with 2g metaspace have 0 crashes. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: MCWP-574 ## **Manual testing steps** ```gherkin Feature: Android release build stability Scenario: Build completes without daemon crashes Given a Build Mobile App workflow run on a branch with this fix When the Android build job completes Then the logs show 0 "daemon has disappeared" messages And the "Build android" step duration is ~20min (vs ~22min with crashes) ``` ## **Screenshots/Recordings** N/A - CI config change ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) - [ ] I've tested on Android - Ideally on a mid-range device; emulator is acceptable - [ ] I've tested with a power user scenario - Use these [power-user SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93) to import wallets with many accounts and tokens - [ ] I've instrumented key operations with Sentry traces for production performance metrics - See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example For performance guidelines and tooling, see the [Performance Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers). ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent 34ffb5c commit 4d76783

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

android/gradle.properties.release

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Gradle settings for GitHub Actions release/production builds (LG runner, 48GB RAM)
22

33
# JVM: 8GB heap to leave room for Metro workers + Kotlin daemon
4-
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=512m -XX:+UseG1GC -XX:G1HeapRegionSize=8m -XX:+UseStringDeduplication -XX:+OptimizeStringConcat -XX:+ExitOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
4+
# MaxMetaspaceSize 2g to match gradle.properties.github (512m causes daemon OOM)
5+
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=2g -XX:+UseG1GC -XX:G1HeapRegionSize=8m -XX:+UseStringDeduplication -XX:+OptimizeStringConcat -XX:+ExitOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
56

67
org.gradle.parallel=true
78
org.gradle.configureondemand=true
@@ -16,8 +17,8 @@ org.gradle.vfs.watch=false
1617
kotlin.incremental=true
1718
kotlin.incremental.android=true
1819
kotlin.caching.enabled=true
19-
# Kotlin daemon: 2GB cap to prevent memory contention
20-
kotlin.daemon.jvmargs=-Xmx2g -XX:+UseG1GC -XX:+ExitOnOutOfMemoryError
20+
# Kotlin daemon: 2GB heap, 1GB metaspace to match gradle.properties.github
21+
kotlin.daemon.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:+ExitOnOutOfMemoryError
2122

2223
# File system optimizations
2324
org.gradle.vfs.verbose=false

0 commit comments

Comments
 (0)