Redline: native resources of an unclosed Instance are never released (no Cleaner fallback)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start by tracing the Instance lifecycle and Engine.close() to identify ownership of the native machine, memory, trampolines, closures or upcall stubs, and buffers. Read the redline documentation alongside the cleanup code, then verify that unreachable native instances are reclaimed and explicitly closed instances still release resources without regressions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A native Instance that is dropped without close() leaks all of its off-heap resources: the executable code region (~8 MB for a QuickJS-sized module), trampolines, jffi closures / Panama upcall stubs, ctx and args buffers, the tables and the linear memory. Nothing is registered with a java.lang.ref.Cleaner, so GC never reclaims them, unlike a bytecode instance where everything lives on the heap.
Measured with quickjs4j on Endive 1.1.0 (javy module, jffi runner, JDK 21): creating and dropping an engine without closing its instance grows RSS by ~30 MB per instance, linearly (1 GB after 20). With Instance.close() it saturates after JIT warm-up (~1 MB per instance residual over 50 instances, worth a look but minor).
quickjs4j had exactly this bug (Engine.close() never closed the Instance, which was harmless on bytecode) and other embedders will too. Suggested:
- register the native machine and memory with a
Cleaneras a fallback, so an unreachable instance releases its native resources on GC; - document in the redline docs that native instances must be closed, since the bytecode fallback never required it.
🤖 Generated with Claude Code
- Lingua principale
- Java
- Stelle
- 310
- Fork
- 23
- Merge medio
- 1g 22h
- PR unite (30g)
- 34
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 35/100
bytecodealliance/endive#225 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
bytecodealliance/endive#224 · 8 commenti ·
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à 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
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
bytecodealliance/endive#175 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bytecodealliance/endive
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ShaftHQ/SHAFT_ENGINE#6909 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
mudler/parakeet.cpp#99 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Re-subscribing the Mono returned by listTools/listResources/listResourceTemplates/listPrompts/listRoots duplicates the resultsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/java-sdk#1174 · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
建议在文档中补充逻辑删除与唯一索引冲突的处理方案Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
baomidou/mybatis-plus#7185 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
refinedmods/refinedstorage2#1419 ·