Have a different function when ROCKSDB_JEMALLOC=0

Summary:
Some sanitizer is not happy with parameter name with ROCKSDB_JEMALLOC not set. Use another function instead.
Closes https://github.com/facebook/rocksdb/pull/3536

Differential Revision: D7064849

Pulled By: siying

fbshipit-source-id: c6ae94e044686176af1259df9172453d52c2f9d5
This commit is contained in:
Siying Dong 2018-02-23 11:30:55 -08:00 committed by Facebook Github Bot
parent 90eca1e616
commit 30649dc6a1

View File

@ -41,8 +41,8 @@ static void GetJemallocStatus(void* mstat_arg, const char* status) {
} }
#endif // ROCKSDB_JEMALLOC #endif // ROCKSDB_JEMALLOC
void DumpMallocStats(std::string* stats) {
#ifdef ROCKSDB_JEMALLOC #ifdef ROCKSDB_JEMALLOC
void DumpMallocStats(std::string* stats) {
MallocStatus mstat; MallocStatus mstat;
const unsigned int kMallocStatusLen = 1000000; const unsigned int kMallocStatusLen = 1000000;
std::unique_ptr<char[]> buf{new char[kMallocStatusLen + 1]}; std::unique_ptr<char[]> buf{new char[kMallocStatusLen + 1]};
@ -50,8 +50,10 @@ void DumpMallocStats(std::string* stats) {
mstat.end = buf.get() + kMallocStatusLen; mstat.end = buf.get() + kMallocStatusLen;
je_malloc_stats_print(GetJemallocStatus, &mstat, ""); je_malloc_stats_print(GetJemallocStatus, &mstat, "");
stats->append(buf.get()); stats->append(buf.get());
#endif // ROCKSDB_JEMALLOC
} }
#else
void DumpMallocStats(std::string*) {}
#endif // ROCKSDB_JEMALLOC
} }
#endif // !ROCKSDB_LITE #endif // !ROCKSDB_LITE