top showed memory is much larger than heap profiler showed memory
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
> Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://www.facebook.com/groups/rocksdb.dev
I use rocksdb in container, so the memory usage is really important for me. I found that rocksdb use much more memory than I expected. Therefore, I heap profile rocksdb and found that memory use in heap is 75MB, but pmap or top showed that it use 250MB+ memory, why?
How can I reduce the gap?
The gap between heap allocated memory and RES column in "top" command should be small.
### Steps to reproduce the behavior
Just always Put() into rocksdb will reproduce the problem.
```
void WriteTestDB() {
rocksdb::Options options;
options.create_if_missing = true;
rocksdb::DB* db = NULL;
rocksdb::Status st = rocksdb::DB::Open(options, FLAGS_db_path, &db);
CHECK(st.ok()) << "Fail to open leveldb:" << FLAGS_db_path;
for (int i = 0; i < 1000000; ++i) {
string key = StringPrintf("key_%03d", i);
string value = StringPrintf("value_%03d", i);
db->Put(rocksdb::WriteOptions(), key, value);
}
delete db;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.