Runtime compiler retains excessive memory
I maintainer di solito rispondono entro 1 giorno
@andreas-karlsson ci sta già lavorando.
Dal 23/10/2026.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- java, wasm
- Ambito
- backend, performance
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 315
- Fork
- 24
- Merge medio
- 1g 3m
- PR unite (30g)
- 29
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bytecodealliance/endive
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
bytecodealliance/endive#250 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
bytecodealliance/endive#225 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
bytecodealliance/endive#211 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
bytecodealliance/endive#203 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
bytecodealliance/endive#181 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bytecodealliance/endive
Issue simili
-
:Search Relevance/Vectors >test-failure needs:risk Team:Search Relevance
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
elastic/elasticsearch#163668 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
agent:working bug follow-up lane:auto
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Sanne/incus-spawn#1765 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Mend: dependency security vulnerability untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
opensearch-project/data-prepper#7219 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno