Heap diagnostics¶
From 0.29.0, Stove can compare the heap at the start and end of an end-to-end run. Choose one capture source in your Stove setup and use matching Stove Dashboard and Server builds. For an application in the HotSpot test JVM:
import com.trendyol.stove.dashboard.DashboardSystemOptions
import com.trendyol.stove.dashboard.dashboard
import com.trendyol.stove.dashboard.heapDiagnostics
Stove().with {
dashboard { DashboardSystemOptions(appName = "checkout") }
heapDiagnostics()
// Register your application runner as usual.
}.run()
Stove.run() captures a baseline after the application starts. Stove.stop() captures again just before stopping the application. Both captures can trigger full garbage collection. They measure the whole test JVM, including the in-process application, the test framework, and background work. Child processes, containers, and profiled Go applications have their own heaps.
In Drill Down → This run → Memory, compare live bytes and instance counts by class. These are shallow sizes: an object's own bytes without the objects it references. Stove includes up to 200 changed classes or allocation sites. Pyroscope profiling can provide complementary allocation stacks.
The inventory audit demo produces real baseline and faulty runs without Docker. Use the class histogram to count the extra receipts, then follow their archive in the shutdown dump.
All examples and recipes register heap diagnostics. With a matching Stove Server running, try ./gradlew :examples:cucumber-example:test --rerun for a JVM histogram without Docker. The standalone Spring example uses Actuator on a loopback management port and includes retained objects. The Ktor OIDC BFF uses JVM histograms in JVM mode and snapshots from the native executable in native mode.
Capture from an application endpoint¶
For a separate process, container, or provided application, configure a URL that the Stove test JVM can reach. Stove sends a GET after the runner starts the app and again before it stops the app. Both calls must reach the same application instance. No profiler agent is needed when the app already serves the snapshots.
Spring Boot or any HotSpot HPROF endpoint. For Spring Boot Actuator, expose heapdump in your test environment (for example, management.endpoints.web.exposure.include=health,heapdump). On Spring Boot 3.4 and later, also set management.endpoint.heapdump.access=read-only. Use a live HPROF endpoint; OpenJ9's PHD format is unsupported. Add this inside the same Stove().with { ... } block in place of heapDiagnostics():
heapDiagnostics(
endpoint = "http://127.0.0.1:8080/actuator/heapdump",
retainedObjects = true, // Optional GC root paths from the shutdown dump
runtime = "checkout HotSpot 25"
)
Go net/http/pprof. Use the binary heap endpoint. gc=1 requests a collection before each capture. Omit seconds and debug to get a binary snapshot rather than a delta or text response.
import com.trendyol.stove.dashboard.HeapEndpointFormat
heapDiagnostics(
endpoint = "http://127.0.0.1:6060/debug/pprof/heap?gc=1",
format = HeapEndpointFormat.GO_PPROF
)
Go reports estimated live bytes and objects by allocation site from inuse_space and inuse_objects. It can point to where growing memory was allocated. Samples without a function symbol still count toward heap totals; Stove leaves them out of the allocation-site rows and marks the report as partial. It does not contain an object graph or GC root paths. Custom endpoints can serve either supported format; the implementation behind the URL does not matter. Go's runtime/debug.WriteHeapDump produces a different format. Stove supports neither that format nor OS core dumps.
The Go showcase already enables this endpoint in both its process and container suites.
Keep these endpoints private to the test environment. If authentication is required, pass headers = mapOf("Authorization" to ...). Stove does not follow redirects. Downloads go to private temporary files with a 60 second limit per capture. HPROF downloads are limited to 512 MiB; Go pprof is limited to 16 MiB compressed and 32 MiB decompressed. Once the shutdown capture is on disk, analysis can run while the app stops. Stove publishes the comparison and removes the files during teardown after the stop attempt. Only the bounded comparison reaches Stove Server. Failed or missing captures leave the test outcome unchanged.
Investigate what keeps objects alive¶
Use retainedObjects = true with the HotSpot test JVM or an HPROF endpoint. In the test JVM, Stove checks free disk space and writes one extra HPROF just before stopping the application. With an endpoint, it reuses the second download. Stove uses the VisualVM heap library in a separate JVM. The worker's heap limit starts at 256 MiB and its deadline at 30 seconds. Both grow with dump size, up to 2 GiB and ten minutes. Endpoint comparison and any retention analysis share that budget. An abrupt process kill can leave temporary files behind.
The Memory view shows up to five objects with the largest retained size and up to eight references toward a GC root for each. Retained size estimates how many bytes could be freed if that object became unreachable. Sizes can overlap. Paths show class and field names when available and can stop before reaching a root. Only the shutdown snapshot has this evidence.
Choose View shutdown dominators to jump from the totals to the retained objects. Each row shows its retained size and the first reference holding it, when known. In the inventory audit example, the library object is a java.util.ArrayList, but Held by points to the application field ReservationAudit.archive. Expand the row to see the list's shallow size and follow the references toward a GC root.

Use Code scope to filter reported class changes (Go: allocation sites) by application or dependency package. For retained objects, the filter also checks classes on the displayed root path, so the map in that example appears under the application's prefix. Outside application shows objects with no matching class on that bounded path or the object itself. Summary totals always describe the whole heap.
Live dump capture can pause the application JVM and depends on heap size and disk speed. Stove reports capture and retention analysis durations separately. If optional retention analysis fails after the comparison is ready, you can still see class changes. Stove sends only the bounded summaries via Dashboard, with no raw dumps, object contents, or reference graph.
How much time does an HPROF endpoint add to Stove.stop()?¶
With 499.3–507.5 MiB Spring Boot Actuator dumps, class comparison added less than a second in every measured trial. Retained-object analysis was more sensitive to the shape of the heap. Times below are additional wall time relative to the disabled control for the same heap and round: median of three trials, with min–max in parentheses. Spring took about 2.08 s to stop with diagnostics off.
| Shutdown heap | Comparison only | Comparison + retained objects | Retention outcome |
|---|---|---|---|
| Mostly large arrays (~0.47 million objects) | +0.59 s (0.55–0.68) | +0.59 s (0.57–0.60) | 3/3 completed |
| Small objects with byte arrays (~4.55 million) | +0.55 s (0.53–0.77) | +3.27 s (3.14–4.05) | 3/3 completed |
| Linked cache entries sharing byte arrays (~8.77 million) | +0.68 s (0.60–0.69) | +28.58 s (28.51–28.59) | 3/3 timed out; class comparisons available |
The startup baseline took 0.54 s median, separately from shutdown. The shutdown capture took 0.57 s median and is already included in the stop timings. With large arrays, the worker finished while Spring was stopping. With the linked cache, total stop time reached 30.66 s median. All 18 measured runs with diagnostics published the expected class change; the serialized reports were 9.1–11.3 KiB. For routine CI, use comparison only. Enable retainedObjects = true when an investigation needs GC root paths.
Reproduce: run ./gradlew :lib:stove-dashboard:benchmarkHeapDiagnostics from the repository root. It starts a fresh Spring context per trial in one JVM, downloads two fresh live dumps over loopback, measures the files on disk, and checks capture cleanup. Round 0 is a warmup; rounds 1–3 rotate the mode order. Raw timings were collected on an 18-core Apple M5 Pro with 48 GiB RAM, macOS 27.2.1, Temurin 25.0.5 and Spring Boot 3.5.16. The fixture used a 1.5 GiB JVM heap limit and the earlier fixed analyzer limits of 256 MiB and 30 seconds. Current results can differ because the worker now scales its limits. Remote network, CI disk and Stove Server delivery times were not measured.
The task runs only when invoked and needs several GiB of free disk. Its CSV is written to lib/stove-dashboard/build/reports/heap-benchmark/timings.csv; report_bytes = 0 means no report was published.
Compare runs¶
Open Drill Down → Run history → Memory. The history uses the dashboard's app and metadata filters. Stove considers up to ten completed runs with captures, including passes and failures, grouped by source and runtime. The test JVM reports its version and object layout. For an endpoint, use runtime or Dashboard metadata to split captures after a runtime or sampling configuration change. A class or allocation site gets a signal when it grows by at least 64 KiB in two or more runs and in at least half of its comparable group. An absent row means zero change when the comparison is complete. In a partial comparison, its change is unknown and is shown as Not reported.
Set Baseline run to run 3 and Target run to run 5 to compare their shutdown heaps. Run 4 is included by default. Turn off Include intermediate runs to compare only runs 3 and 5. Recurring class growth is recalculated on that selection. Each row's startup-to-shutdown change is still local to that run.
If retained-object evidence is available, Heap dominators across runs compares the largest reported object of a chosen class at shutdown against the baseline run. It does not sum overlapping retainers or track individual object identities between JVMs. A class outside the top five has an unknown retained size, not zero. Go pprof has no dominator evidence.
Compare runs with similar workloads and settings. Warmup, caches, and different amounts of work can all cause growth. Use a recurring signal to select a run and look at the supporting snapshot before concluding that there is a leak.

Agents can ask Stove MCP for the same evidence using stove_heap_trends and stove_heap_diagnostics.