Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Redline: native resources of an unclosed Instance are never released (no Cleaner fallback)

Aperta
#203 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, wasm
Ambito
backend

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 Cleaner as 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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bytecodealliance/endive

Tutte le issue di bytecodealliance/endive

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.