1

I'm using localforage with its IndexedDB driver for storing simple key-value-pairs. But I encountered a problem when trying to remove or update values.

Whenever I call localforage.removeItem("existingKey") or localforage.setItem("existingKey", "some value") with a key of an existing entry no memory is freed.

When using WebSQL instead of IndexedDB the behavior does no occur.

Example on JsBin (Only works in Chrome due to calls to navigator.storage)

oli
  • 691
  • 1
  • 8
  • 13
  • Maybe Chrome keeps around deleted records in memory until memory needs to be freed, and/or the storage query algorithm incorrectly counts deleted records along with normal data? I know there is some complicated code around when data actually gets flushed to disk, so maybe the delete is not immediately flushed, and this behavior possibly varies by browser. – Josh Nov 15 '17 at 13:40
  • IndexedDB in Chrome will retain some memory while performing transactions until it reaches about 4Mb then it will dump. – holmberd May 09 '19 at 19:12

0 Answers0