1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Rework [76c8435a] to eliminate automatic JS-to-WASM function conversions of sqlite3_set_auxdata() destructors because it can leads to leaks on every call of a UDF. This feature never worked before [76c8435a] but fixing it was ill-conceived because of the memory leakage it introduces. WASM function pointers can still be used as destructors in this context.

FossilOrigin-Name: 3fb993af0caf041da934cea29c039b27c468be0b75bce1537a6425767cf9bf8d
This commit is contained in:
stephan
2025-02-03 17:34:12 +00:00
parent d98689f4d3
commit 3cd34ab981
4 changed files with 35 additions and 24 deletions

View File

@ -3469,9 +3469,9 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
We do not currently an automated way to clean up
auxdata finalizer functions (the 4th argument to
sqlite3_set_auxdata()) which get automatically
converted from JS to WASM. Because of that, relying
on automated conversions for those is not
recommended. Instead, follow the pattern show in
converted from JS to WASM. Because of that, enabling
automated conversions here would lead to leaks more
often than not. Instead, follow the pattern show in
this function: use wasm.installFunction() to create
the function, then pass the resulting function
pointer this function, and cleanup (at some point)