Skip to content

chore: size the forked test JVM heap - #391

Open
abelonogov-ld wants to merge 2 commits into
mainfrom
andrey/test-jvm-heap-size
Open

chore: size the forked test JVM heap#391
abelonogov-ld wants to merge 2 commits into
mainfrom
andrey/test-jvm-heap-size

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Why

org.gradle.jvmargs=-Xmx4608M in gradle.properties sizes the Gradle daemon, not the JVM Gradle forks to run tests. That one is left at Gradle's 512m default — no maxHeapSize is set anywhere in the build, and forkEvery is 0, so the whole module suite shares a single 512m JVM.

Measured over a full run of :launchdarkly-android-client-sdk:testReleaseUnitTest with GC logging, the suite spends most of its collector time against that ceiling:

full GCs total GC events live set after full GC
512m (current) 1048 5788 ~158m
2g (this PR) 242 2493 ~168m

The live set is modest, so this is headroom rather than a leak: a 512m ceiling over a ~160m working set with this much allocation churn just means constant full collections, and no margin when a test allocates a transient burst.

What this is not

This is not a fix for the intermittent OutOfMemoryError in FDv2DataSourceTest. That one is a spinning loop that retains memory until it exhausts whatever heap it is given — it still OOMs at 2g — and is fixed separately in #390. Deliberately kept apart so neither change is credited with the other's effect.

Test plan

  • ./gradlew test passes locally
  • Confirmed via -Xlog:gc that the numbers above are the before/after for the same task

Nothing shipped changes, so this is chore and should not cut a release.

Note: CI on this branch may hit the FDv2DataSourceTest flake until #390 merges, since this branch is on current main.


Note

Overview
Build-only change: every subproject Test task now sets maxHeapSize = "2g" on the forked JVM Gradle uses to run unit tests. org.gradle.jvmargs still only sizes the Gradle daemon; without this, tests stayed on Gradle’s 512m default and the full suite spent most of its time in full GC despite a modest live set.

This is aimed at faster, less GC-heavy test runs, not at fixing the intermittent FDv2DataSourceTest OOM (that’s handled separately). Nothing in the shipped SDK changes.

Reviewed by Cursor Bugbot for commit ecac6aa. Bugbot is set up for automated code reviews on this repo. Configure here.

org.gradle.jvmargs sizes the Gradle daemon, not the JVM forked for tests,
which Gradle leaves at its 512m default. The unit test suite runs right
against that ceiling: measured over a full run of the SDK module, 1048 of
5788 GC events were full collections, against a steady live set of ~158m.
At 2g the same run does 242 full collections out of 2493.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld requested a review from a team as a code owner August 17, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants