assembleDebug runs out of memory when rebuilding all examples
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #28 @afarber による — マージ済み
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- build-system
調査の方向性
The fix is configuration, so start in gradle.properties (the org.gradle.jvmargs=-Xmx4096m heap and where worker limits would go) and check settings.gradle.kts. The failing task is mergeExtDexDebug in the example modules, such as examples:Example04Polylines. Reproduce with ./gradlew --stop then ./gradlew assembleDebug --rerun-tasks. Done means that command succeeds without --max-workers. Confirm with the maintainer which of the two proposed fixes to take, since raising the heap and capping workers trade off differently.
索引モデルが issue の本文から書いたものです。
説明
A full rebuild of the example apps fails with OutOfMemoryError: Java heap space in the Gradle daemon on machines with many CPU cores.
Steps to reproduce
./gradlew --stop
./gradlew assembleDebug --rerun-tasks
On a 14-core Mac this fails after about 15 seconds, usually in mergeExtDexDebug of one or more examples:
> Task :examples:Example04Polylines:mergeExtDexDebug FAILED
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Caused by: java.lang.OutOfMemoryError: Java heap space
After the failure the daemon can be left in a broken state ("Cannot lock file hash cache ... already been locked by this process"), so ./gradlew --stop is needed before the next build.
The same failure also happens without --rerun-tasks whenever all examples need to be rebuilt, for example after a change in the library or in settings.gradle.kts. Incremental builds are not affected.
Cause
All 12 example apps run dex merging in parallel inside the Gradle daemon. The number of parallel workers defaults to the number of CPU cores, but the daemon heap is limited to 4 GB (org.gradle.jvmargs=-Xmx4096m in gradle.properties). CI is not affected because its runners have fewer cores.
Limiting the workers avoids the problem:
./gradlew --stop
./gradlew assembleDebug --rerun-tasks --max-workers=4 # BUILD SUCCESSFUL
Possible fixes
- Increase the daemon heap in
gradle.properties, for example-Xmx6g - Or limit parallelism with
org.gradle.workers.maxingradle.properties
- 主要言語
- Kotlin
- スター
- 4
- フォーク
- 1
- 平均マージ
- 1時間 1分
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
supabase-community/supabase-kt#1413 ·
メンテナーはふだん 5 日以内に返信
-
Type: Possible bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
spacecowboy/Feeder#1258 ·
メンテナーはふだん 1 日以内に返信
-
[Submission] 抖音火山版オープンsubmit-adaption submit-adaption-pre
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
BetterAndroid/android-notification-icon-project#744 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
utopia-rise/godot-jvm#1004 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
pedroSG94/RootEncoder#2213 ·
メンテナーはふだん 2 日以内に返信