Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ allprojects {
TestLogEvent.PASSED,
TestLogEvent.FAILED
)

// Cap JVM args per test
minHeapSize = "256m"
maxHeapSize = "2g"
}
Comment on lines 105 to 106

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Removing the global maxHeapSize leaves four Robolectric-using modules without an explicit heap cap, risking OutOfMemoryError in their test tasks.
Severity: MEDIUM

Suggested Fix

Apply explicit maxHeapSize settings to the testOptions.unitTests.all block for each of the affected modules: sentry-android-replay, sentry-compose, sentry-android-navigation, and sentry-android-distribution. A setting like maxHeapSize = "2g" would be consistent with the previous global configuration and the fix applied to sentry-android-core.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: build.gradle.kts#L105-L106

Potential issue: The removal of the global `maxHeapSize` setting in the root
`build.gradle.kts` leaves four modules that use Robolectric (`sentry-android-replay`,
`sentry-compose`, `sentry-android-navigation`, `sentry-android-distribution`) without an
explicit heap size configuration. These modules enable `isIncludeAndroidResources`,
which causes Robolectric to load the large `android-all` jar. Without a defined
`maxHeapSize`, their test tasks will rely on default JVM memory settings, which may be
insufficient and lead to `OutOfMemoryError` failures in the test environment,
particularly in CI or as test suites expand.

Did we get this right? 👍 / 👎 to inform future reviews.

withType<JavaCompile>().configureEach {
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing", "-Xlint:-try"))
Expand Down
6 changes: 6 additions & 0 deletions sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ android {
unitTests.apply {
isReturnDefaultValues = true
isIncludeAndroidResources = true
// Robolectric loads the android-all jar into each test JVM, which needs more heap
// than the default.
all {
it.minHeapSize = "256m"
it.maxHeapSize = "2g"
}
}
}

Expand Down
Loading