From 3bcc31295a3e434e29c9af93f80fa16421464edd Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Wed, 9 Jan 2019 15:51:02 -0800 Subject: [PATCH] Initialize two members in PerfContext (#4859) Summary: as titled. Currently it's possible to create a local object of type PerfContext since it's part of public API. Then it's safe to initialize the two members to 0. If PerfContext is created as thread-local object, then all members are zero-initialized according to C++ standard. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4859 Differential Revision: D13614504 Pulled By: riversand963 fbshipit-source-id: 406ff548e105a074f379ad1054d56fece5f524a0 --- include/rocksdb/perf_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rocksdb/perf_context.h b/include/rocksdb/perf_context.h index 1b11fa3cc..3f125c213 100644 --- a/include/rocksdb/perf_context.h +++ b/include/rocksdb/perf_context.h @@ -201,8 +201,8 @@ struct PerfContext { uint64_t env_lock_file_nanos; uint64_t env_unlock_file_nanos; uint64_t env_new_logger_nanos; - std::map* level_to_perf_context; - bool per_level_perf_context_enabled; + std::map* level_to_perf_context = nullptr; + bool per_level_perf_context_enabled = false; }; // Get Thread-local PerfContext object pointer