Remove function local statics that interfere with memory pooling (#1392)

main
Dmitri Smirnov 8 years ago committed by yiwu-arbug
parent f47054015d
commit b1031d6c12
  1. 6
      util/options_helper.cc
  2. 1
      util/options_helper.h
  3. 2
      util/options_parser.cc

@ -26,6 +26,8 @@
namespace rocksdb { namespace rocksdb {
const std::string kNullptrString = "nullptr";
DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options, DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
const MutableDBOptions& mutable_db_options) { const MutableDBOptions& mutable_db_options) {
DBOptions options; DBOptions options;
@ -451,7 +453,7 @@ bool ParseSliceTransformHelper(
const std::string& kFixedPrefixName, const std::string& kCappedPrefixName, const std::string& kFixedPrefixName, const std::string& kCappedPrefixName,
const std::string& value, const std::string& value,
std::shared_ptr<const SliceTransform>* slice_transform) { std::shared_ptr<const SliceTransform>* slice_transform) {
static const std::string kNullptrString = "nullptr";
auto& pe_value = value; auto& pe_value = value;
if (pe_value.size() > kFixedPrefixName.size() && if (pe_value.size() > kFixedPrefixName.size() &&
pe_value.compare(0, kFixedPrefixName.size(), kFixedPrefixName) == 0) { pe_value.compare(0, kFixedPrefixName.size(), kFixedPrefixName) == 0) {
@ -577,7 +579,7 @@ bool ParseOptionHelper(char* opt_address, const OptionType& opt_type,
bool SerializeSingleOptionHelper(const char* opt_address, bool SerializeSingleOptionHelper(const char* opt_address,
const OptionType opt_type, const OptionType opt_type,
std::string* value) { std::string* value) {
static const std::string kNullptrString = "nullptr";
assert(value); assert(value);
switch (opt_type) { switch (opt_type) {
case OptionType::kBoolean: case OptionType::kBoolean:

@ -693,6 +693,7 @@ static std::unordered_map<std::string, InfoLogLevel> info_log_level_string_map =
{"FATAL_LEVEL", InfoLogLevel::FATAL_LEVEL}, {"FATAL_LEVEL", InfoLogLevel::FATAL_LEVEL},
{"HEADER_LEVEL", InfoLogLevel::HEADER_LEVEL}}; {"HEADER_LEVEL", InfoLogLevel::HEADER_LEVEL}};
extern const std::string kNullptrString;
#endif // !ROCKSDB_LITE #endif // !ROCKSDB_LITE
} // namespace rocksdb } // namespace rocksdb

@ -510,7 +510,7 @@ bool AreEqualOptions(
const std::unordered_map<std::string, std::string>* opt_map) { const std::unordered_map<std::string, std::string>* opt_map) {
const char* offset1 = opt1 + type_info.offset; const char* offset1 = opt1 + type_info.offset;
const char* offset2 = opt2 + type_info.offset; const char* offset2 = opt2 + type_info.offset;
static const std::string kNullptrString = "nullptr";
switch (type_info.type) { switch (type_info.type) {
case OptionType::kBoolean: case OptionType::kBoolean:
return (*reinterpret_cast<const bool*>(offset1) == return (*reinterpret_cast<const bool*>(offset1) ==

Loading…
Cancel
Save