Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Runtime compiler retains excessive memory

オープン
#249 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@andreas-karlsson がすでに取り組んでいます。

2026年10月23日 から。

  • #251 @andreas-karlsson による — マージされずにクローズ
  • #252 @andreas-karlsson による — オープン

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, wasm

調査の方向性

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 WasmModule parse 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 withDiscardCompiledFunctionBodies which retains a stripped WasmModule, keeping only bodies of interpreted functions (and their tail-call targets). Accessing a stripped function throws IllegalStateException. The downside is that Instance#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 MachineFactory from 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 to Instance.builder(module).withMachineFactory(factory) and own the trade-off themselves.
主要言語
Java
スター
315
フォーク
24
平均マージ
1日 3分
マージ済み PR(30日)
29

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/endive のほかの issue

bytecodealliance/endive の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。