sql-js / sql-js/sql.js

Not possible to free memory used by WASM (without using a web worker)

Offen
#628 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
13.7k
Forks
1.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

It is desirable to be able to free up the 20MB+ allocated to the sql.js WASM in the JavaScript heap if this is only used for initial loading of data. This is not currently possible because the var initSqlJsPromise is held in a closure within the module and there is also no way to assign "undefined" to it once is no longer required (which would allow garbage collection to reclaim the memory). Although I can understand the desire to re-use the existing WASM if initSqlJs() is called more than once, the comment in the existing code hints at the undesirability of implementing it this way:

// TODO: Make this not declare a global if used in the browser
var initSqlJsPromise = undefined;

One solution (assuming exporting an additional function freeSqlJs() is problematic) would be to add a property in moduleConfig to optionally not hold a reference to initSqlJsPromise after initSqlJs() returns it.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Locate initSqlJsPromise and moduleConfig in the JavaScript initialization code, then trace how the WASM instance is retained after initSqlJs() resolves. Review the existing reuse behavior and determine how an opt-out release mechanism should behave; done means the configured path no longer retains the unused WASM memory while normal repeated initialization remains supported.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, sqlite, wasm
Bereich
databases
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.