Open KennanChan opened 2 years ago
I found an undocumented call:
database.adapter.underlyingAdapter?._driver?.loki?.close?.()
Is it safe to use? why not expose a close method?
the loki.close()
just ensure the lokidb do some necessary operations like saveing dirty records etc, which does not destroy the database. I do not find any useful method that lokidb exposed to destroy in-memory data it holds.
It seems I am left to rely on the main gc process to collect the unused lokidb.
Anyone has ideas?
One thing to clarify is that what I mean "destroy" is not to destroy the database on indexedDB, but to destroy the database connnection and the in-memory database to free some memory, since my project is a mobile web page which will be running on some old devices
I am using watermelondb with lokidb on web. I create database shardings to minimize the data transfered and stored in a single pull phase. When I change from a database sharding "A" to a new database sharding "B", I am wondering how I can make sure to destroy the sharding "A" and its in-memory lokidb to avoid memory leak.