Runtime compiler retains excessive memory
メンテナーはふだん 1 日以内に返信
@andreas-karlsson がすでに取り組んでいます。
2026年10月23日 から。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- java, wasm
- 領域
- backend, performance
調査の方向性
Start by tracing how MachineFactoryCompiler, Instance, and MachineFactory retain the WasmModule, then identify how compiled and interpreted functions use their bodies. Compare the three approaches in the issue, including their effects on module fidelity and identity checks. Done means selecting and implementing a memory reduction approach while preserving the required runtime behavior; the issue does not name files or tests.
索引モデルが issue の本文から書いたものです。
説明
A module compiled with MachineFactoryCompiler retains the full WasmModule at runtime (via Instance and MachineFactory). Contractually it needs to do this since Instance has a WasmModule getter, but only interpreted functions actually need the body definitions. For our use case, a server that reads Wasm modules on the fly from cloud storage and deploys them, this "dead code" amounts to ~5 GB, about 70% of our retained heap. The problem is exacerbated by every Wasm instruction being represented by an AnnotatedInstruction, which retains about 70 bytes per instruction (compared to Wasm's native 1–2 bytes).
If agreed that this is a problem that needs fixing, I see a few ways forward (in my order of perference):
- Only retain the original Wasm binary for compiled functions, and let
WasmModuleparse them lazily (with weak memoization). This keeps a faithful representation, and my back-of-napkin calculation suggests a ~30x reduction in memory retained by function bodies (~70 bytes per parsed instruction vs. 1–2 bytes of binary). - Add a builder option like
withDiscardCompiledFunctionBodieswhich retains a strippedWasmModule, keeping only bodies of interpreted functions (and their tail-call targets). Accessing a stripped function throwsIllegalStateException. The downside is thatInstance#module()is no longer a faithful representation. - Or as a lower-level escape hatch: let the compile result expose which function bodies the interpreter needs (interpreted functions and their tail-call targets), stop
MachineFactoryfrom holding on to the module, and relax its module identity check (e.g. to a digest check). Users could then pass their own stripped module toInstance.builder(module).withMachineFactory(factory)and own the trade-off themselves.
- 主要言語
- Java
- スター
- 315
- フォーク
- 24
- 平均マージ
- 1日 3分
- マージ済み PR(30日)
- 29
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/endive のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
bytecodealliance/endive#250 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
bytecodealliance/endive#225 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
bytecodealliance/endive#211 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
bytecodealliance/endive#203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
bytecodealliance/endive#181 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
bytecodealliance/endive の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefix対応中かも @ItsDeadlyProgrammer が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
appsmithorg/appsmith#42471 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
code-maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
bug priority: medium Review effort [1-5]: 3 status: needs-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
carlos-emr/carlos#5258 ·
メンテナーはふだん 1 日以内に返信