Skip to content

Commit 3b9b35e

Browse files
committed
Only enable jemalloc on linux/macos
1 parent ffaea4b commit 3b9b35e

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ jobs:
4040
matrix:
4141
include:
4242
- os: ubuntu
43-
cargoargs: --features build-llvm
43+
cargoargs: --features build-llvm jemalloc
4444
- os: macos
45-
cargoargs: --features build-cranelift
45+
cargoargs: --features build-cranelift jemalloc
4646
- os: windows
4747
cargoargs: --features build-cranelift
4848

@@ -83,14 +83,14 @@ jobs:
8383
run: echo "COMPILED_RUNNERS=compiled_runners" >> $GITHUB_ENV
8484
shell: bash
8585

86-
- if: matrix.os == 'macos' && matrix.cargoargs == '--features build-llvm'
86+
- if: matrix.os == 'macos' && contains(matrix.cargoargs, 'build-llvm')
8787
run: |
8888
brew install llvm@12
8989
echo "LLVM_SYS_120_PREFIX=$(brew --prefix llvm)" >> $GITHUB_ENV
9090
echo 'LDFLAGS="-L/usr/local/opt/llvm@12/lib"' >> $GITHUB_ENV
9191
echo 'CPPFLAGS="-I/usr/local/opt/llvm@12/include"' >> $GITHUB_ENV
9292
93-
- if: matrix.os == 'ubuntu' && matrix.cargoargs == '--features build-llvm'
93+
- if: matrix.os == 'ubuntu' && contains(matrix.cargoargs, 'build-llvm')
9494
run: |
9595
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
9696
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' -y

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ termcolor = "1.4"
5252
textwrap = { version = "0.16", default-features = false }
5353

5454
sentry = "0.32.2"
55-
jemallocator = "0.5.4"
55+
jemallocator = { version = "0.5.4", optional = true }
5656

5757
[features]
58-
default = ["build-cranelift"]
58+
default = ["build-cranelift", "jemallocator"]
5959
build-cranelift = ["wasmer-compiler-cranelift"]
6060
build-llvm = ["wasmer-compiler-llvm", "inkwell", "llvm-sys-120"]
61+
jemalloc = ["jemallocator"]
6162

6263
[build-dependencies]
6364
wasmer = { version = "2.0", default-features = false, features = ["universal"] }

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ mod api;
2626
mod display;
2727
mod server;
2828

29+
#[cfg(feature = "jemalloc")]
2930
#[global_allocator]
3031
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
3132

0 commit comments

Comments
 (0)