Memory leak?
It may be some issue on my side* I'm using [email protected] in app that works for like a really long time. I've started to see slowly increasing memory usage after a few days of constant working.
I've found on internet to maybe close & open db file again to avoid pointers leak but that doesn't seem to fix it. I'm using it in my little experiment how it would be having a tiny database over https since I'm not using it as much and it still takes ~20ms to use even via https.
(Ik it's silly idea, as I said - it's just a test)
Deno starts with like ~16MB usage (following what linux see) and after 40 days, htop see over 90MB usage + 100GB mapped?

I've restarted it and within a week, it again starts to grow:

Hm that’s interesting! The database should be fully self-contained (ie it holds all of the SQLite state inside separate WASM contexts for each database, so closing the database and clearing any references to it should allow V8 to garbage collect everything).
There are some places that keep track of open statements etc, which might not be cleared o correctly(?) I think on the WASM side of things though, there is a 4GB hard limit on the maximum memory size, so you should not see usage beyond that from there (and the get OOM errors once you reach 4GB).
So if the memory leaks in this library, it is presumably the DB object holding on to statements that have already been closed. (We could track that to see if that’s the case?)
Idk man, I'm basically green when comes to WASM. I've decided to use wasm version because then I can freely switch betwen windows & linux, x64 & arm CPU without having issues with libs.
Is there an option to add like extra method, let's call it dbClient#sweep that could on user request sweep memory in the same way as you say it starts after you reach 4GB? It's quite confusing when you work at application and you have no idea what produces extra memory usage all the time.
When closing database and then opening new one (assigned to the same variable) it seems to drop some of that memory but it's not all. Even after I've setup loop to reopen database every 30min of inactivity - it still grows memory over time.
Still - there's possibility that I just did something wrong in my code... I'll leave implementation part here: https://gist.github.com/Amatsagu/cc712ad72459d431e5480ac20c27815b (It's already without this auto reopening loop because I dropped it if it's not working)
Closing this since I can't replicate the issue locally.
I believe this is most likely an issue elsewhere in your APP, since the SQLite library should not be able to allocate much more than 4GB (assuming you don't create and hold on to more than one database instance at a time).