gorocksdb icon indicating copy to clipboard operation
gorocksdb copied to clipboard

Possible memory leak when iterating over database with MergeOperator enabled

Open vitalyisaev2 opened this issue 7 years ago • 2 comments

We faced with memory leak with one of our applications, which periodically iterates over whole Rocksdb database to compute some statistics. We also use MergeOperator implemented in Go, and it turns out that the memory allocated within MergeOperator is never freed.

Please see this repository for the further infomation: https://github.com/vitalyisaev2/gorocksdb_merge_operator_issue

Picture of heap profile to grab your attention: heap profile

vitalyisaev2 avatar Aug 24 '18 17:08 vitalyisaev2

In file gorocksdb.c, an empty implementation of function gorocksdb_filterpolicy_delete_filter and gorocksdb_mergeoperator_delete_value preventing default function free to be called. See rocksdb/blob/master/db/c.cc Which may lead to memory leak.

NgaiShunChan avatar Dec 18 '18 11:12 NgaiShunChan

@NgaiShunChan thanks for the tip, I'm not sure I have understood it right now, but I'll try to make a research

vitalyisaev2 avatar Jan 10 '19 10:01 vitalyisaev2