Skip to content

Commit

Permalink
Set -DROCKSDB_JEMALLOC for buck build if jemalloc presents (facebook#…
Browse files Browse the repository at this point in the history
…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: facebook#4489

Differential Revision: D10363683

Pulled By: yiwu-arbug

fbshipit-source-id: 5da490336a8e78e0feb0900c29e8036e7ec6f12b
  • Loading branch information
Yi Wu authored and facebook-github-bot committed Oct 15, 2018
1 parent 729a617 commit f60c4e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
10 changes: 10 additions & 0 deletions buckifier/targets_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
# 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"))
"""


Expand Down

0 comments on commit f60c4e5

Please sign in to comment.