-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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.