fix: ICP-8826: Workaround for allocation issue in wasmtime-java - #202
Merged
Conversation
wasmtime-java has a leak whenever any linker function is retrieved, thus resulting in a massive leak every iteration when it's fetched as part of the variable evaluation hot path. This adopts the same premise as the C# SDK where storing this reduces, but does not resolve the leak entirely. This minimizes the cost, but it still has a large initial RSS leak that cannot be fixed as each function is initialized/mapped. Due to the EOL of DVC coming - this is the only fix we can reasonably make with acceptable turnarounds.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR mitigates native memory growth in the local bucketing path by avoiding repeated WASM export resolution (which leaks native handles in wasmtime-java), shifting export binding to LocalBucketing construction time.
Changes:
- Cache WASM
Funcbindings (viaWasmFunctions.*) asLocalBucketingfields and reuse them across calls. - Add an
export(String name)helper to resolve exports once and fail fast on missing exports. - Update the release workflow commit email used for automated version bumps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/main/java/com/devcycle/sdk/server/local/bucketing/LocalBucketing.java |
Caches WASM function bindings and adds a helper for one-time export resolution to reduce per-call native handle leaks. |
.github/workflows/release.yml |
Updates the git author email used in the release commit step. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+112
to
+114
| * <p>The returned {@link Func} owns a native handle that is only released by | ||
| * {@code Func.dispose()}, so these must not be fetched per call. | ||
| * |
Comment on lines
+122
to
+125
| * <p>Runtime error behaviour is otherwise unchanged: WASM traps still surface as | ||
| * {@code WasmtimeException} from the calling method, and a trap does not invalidate these | ||
| * bindings. See {@code LocalBucketingErrorHandlingTest}. | ||
| */ |
JamieSinn
force-pushed
the
ICP-8826-use-csharp-init
branch
from
August 19, 2026 19:33
1f6cf0a to
2e7a8d8
Compare
JamieSinn
enabled auto-merge (squash)
August 19, 2026 19:41
jonathannorris
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wasmtime-java has a leak whenever any linker function is retrieved, thus resulting in a massive leak every iteration when it's fetched as part of the variable evaluation hot path.
This adopts the same premise as the C# SDK where storing this reduces, but does not resolve the leak entirely. This minimizes the cost, but it still has a large initial RSS leak that cannot be fixed as each function is initialized/mapped.
Close #195