Commit 72473cd6 authored by ShuYu Wang's avatar ShuYu Wang Committed by siddontang

rocksdb_options: fix #77 memory leaks in cache (#78)

parent f7c020d8
...@@ -73,9 +73,8 @@ impl BlockBasedOptions { ...@@ -73,9 +73,8 @@ impl BlockBasedOptions {
pub fn set_lru_cache(&mut self, size: size_t) { pub fn set_lru_cache(&mut self, size: size_t) {
let cache = crocksdb_ffi::new_cache(size); let cache = crocksdb_ffi::new_cache(size);
unsafe { unsafe {
// because cache is wrapped in shared_ptr, so we don't need to call
// rocksdb_cache_destroy explicitly.
crocksdb_ffi::crocksdb_block_based_options_set_block_cache(self.inner, cache); crocksdb_ffi::crocksdb_block_based_options_set_block_cache(self.inner, cache);
crocksdb_ffi::crocksdb_cache_destroy(cache);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment