swiftwasm / swiftwasm/JavaScriptKit
Improve reference behavior
Nessuno ha ancora preso questa issue.
- Lingua principale
- Swift
- Stelle
- 986
- Fork
- 76
- Merge medio
- 21h 11m
- PR unite (30g)
- 4
Descrizione
I made a small change to report whenever an object ref is deleted:
---
Runtime/src/index.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/Runtime/src/index.ts b/Runtime/src/index.ts
index 0e641ff..ddfba4e 100644
--- a/Runtime/src/index.ts
+++ b/Runtime/src/index.ts
@@ -93,6 +93,7 @@ class SwiftRuntimeHeap {
release(ref: ref) {
const value = this._heapValueById.get(ref);
const isObject = typeof value == "object"
+ console.log('dereferencing', value);
if (isObject) {
const entry = this._heapEntryByValue.get(value)!;
entry.rc--;
(copy the content of the code block and run pbpaste | git apply in your terminal to make this change)
It reports many deallocations. The thing that caught my attention was the repeated deallocation of functions (like toString and hasOwnProperty). I wonder if there’s a way to recognize functions that are part of the JavaScript language and either dynamically call them when needed or mark them so they don’t get released.
Guida per i contributori
Apri 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.
Direzione di ricerca
Inizia con Runtime/src/index.ts, in particolare con SwiftRuntimeHeap.release(ref), e riproduci il report usando la modifica al logging mostrata nell’issue. Confronta le deallocazioni ripetute delle funzioni con la gestione desiderata delle funzioni del linguaggio JavaScript; il lavoro è completato quando viene implementato un comportamento concordato in modo che tali funzioni non vengano rilasciate erroneamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, swift, wasm
- Ambito
- web-dev
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100