Support building RocksDB with jemalloc (#542)

master
Artem Krylysov 3 years ago committed by GitHub
parent cc3a2bec59
commit e6407ed405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .github/workflows/rust.yml
  2. 1
      Cargo.toml
  3. 2
      librocksdb-sys/Cargo.toml
  4. 4
      librocksdb-sys/build.rs

@ -99,3 +99,9 @@ jobs:
with: with:
command: test command: test
args: --features multi-threaded-cf args: --features multi-threaded-cf
- name: Run rocksdb tests (jemalloc)
if: runner.os != 'Windows'
uses: actions-rs/cargo@v1
with:
command: test
args: --features jemalloc

@ -18,6 +18,7 @@ exclude = [
[features] [features]
default = ["snappy", "lz4", "zstd", "zlib", "bzip2"] default = ["snappy", "lz4", "zstd", "zlib", "bzip2"]
jemalloc = ["librocksdb-sys/jemalloc"]
valgrind = [] valgrind = []
snappy = ["librocksdb-sys/snappy"] snappy = ["librocksdb-sys/snappy"]
lz4 = ["librocksdb-sys/lz4"] lz4 = ["librocksdb-sys/lz4"]

@ -13,6 +13,7 @@ links = "rocksdb"
[features] [features]
default = [ "static" ] default = [ "static" ]
jemalloc = ["jemalloc-sys"]
static = [] static = []
snappy = [] snappy = []
lz4 = [] lz4 = []
@ -22,6 +23,7 @@ bzip2 = []
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
jemalloc-sys = { version = "0.3", features = ["unprefixed_malloc_on_supported_platforms"], optional = true }
[dev-dependencies] [dev-dependencies]
const-cstr = "0.3" const-cstr = "0.3"

@ -187,6 +187,10 @@ fn build_rocksdb() {
config.define("ROCKSDB_SUPPORT_THREAD_LOCAL", None); config.define("ROCKSDB_SUPPORT_THREAD_LOCAL", None);
if cfg!(feature = "jemalloc") {
config.define("WITH_JEMALLOC", "ON");
}
if target.contains("msvc") { if target.contains("msvc") {
config.flag("-EHsc"); config.flag("-EHsc");
} else { } else {

Loading…
Cancel
Save