From f60c4e5a58e67402c97587a17b7259bc00ab50a8 Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Mon, 15 Oct 2018 11:39:54 -0700 Subject: [PATCH] Set -DROCKSDB_JEMALLOC for buck build if jemalloc presents (#4489) Summary: Set the macro if default allocator is jemalloc. It doesn't handle the case when allocator is specified, e.g. ``` cpp_binary( name="xxx" allocator="jemalloc", # or "malloc" or something else deps=["//rocksdb:rocksdb"], ) ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/4489 Differential Revision: D10363683 Pulled By: yiwu-arbug fbshipit-source-id: 5da490336a8e78e0feb0900c29e8036e7ec6f12b --- TARGETS | 10 ++++++++++ buckifier/targets_cfg.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/TARGETS b/TARGETS index bccdc48bc..9a951ddde 100644 --- a/TARGETS +++ b/TARGETS @@ -67,6 +67,16 @@ is_opt_mode = build_mode.startswith("opt") if is_opt_mode: rocksdb_compiler_flags.append("-DNDEBUG") +default_allocator = read_config("fbcode", "default_allocator") + +sanitizer = read_config("fbcode", "sanitizer") + +# Let RocksDB aware of jemalloc existence. +# Do not enable it if sanitizer presents. +if default_allocator.startswith("jemalloc") and sanitizer == "": + rocksdb_compiler_flags.append("-DROCKSDB_JEMALLOC") + rocksdb_external_deps.append(("jemalloc", None, "headers")) + cpp_library( name = "rocksdb_lib", srcs = [ diff --git a/buckifier/targets_cfg.py b/buckifier/targets_cfg.py index e63a2860f..98e1f51e2 100644 --- a/buckifier/targets_cfg.py +++ b/buckifier/targets_cfg.py @@ -70,6 +70,16 @@ is_opt_mode = build_mode.startswith("opt") # doesn't harm and avoid forgetting to add it. if is_opt_mode: rocksdb_compiler_flags.append("-DNDEBUG") + +default_allocator = read_config("fbcode", "default_allocator") + +sanitizer = read_config("fbcode", "sanitizer") + +# Let RocksDB aware of jemalloc existence. +# Do not enable it if sanitizer presents. +if default_allocator.startswith("jemalloc") and sanitizer == "": + rocksdb_compiler_flags.append("-DROCKSDB_JEMALLOC") + rocksdb_external_deps.append(("jemalloc", None, "headers")) """ -- GitLab