tecbot/gorocksdb

Possible memory leak when iterating over database with MergeOperator enabled

vitalyisaev2 opened this issue · 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

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 thanks for the tip, I'm not sure I have understood it right now, but I'll try to make a research