Level / classic-level

An abstract-level database backed by LevelDB.
MIT License
58 stars 11 forks source link

Possible memory leak when putting a value with the same key #87

Closed marcus-pousette closed 9 months ago

marcus-pousette commented 9 months ago

When putting a value into the db with an existing key (and the same value) I see that the size of the db folder just grows. Expected behaviour is that it will remain the same size if I re-insert an entry as the old value is to be overwritten.

I use

store.put(key, value, { valueEncoding: "view" })

I get the same results using the batch put method. I get the same results using sync: true

Deleteing the entry seems to clear up all the data that has accumulated for all insertions on the same key.

I am using version "1.3.0"

marcus-pousette commented 9 months ago

I realized that this is intended behaviour for performance reasons. Disc size never seems to exceed 10mb as pruning will start to kick in eventually.