Skip to content

Commit

Permalink
Only enable jemalloc on linux/macos
Browse files Browse the repository at this point in the history
  • Loading branch information
outkine committed Mar 26, 2024
1 parent ffaea4b commit 3b9b35e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
matrix:
include:
- os: ubuntu
cargoargs: --features build-llvm
cargoargs: --features build-llvm jemalloc
- os: macos
cargoargs: --features build-cranelift
cargoargs: --features build-cranelift jemalloc
- os: windows
cargoargs: --features build-cranelift

Expand Down Expand Up @@ -83,14 +83,14 @@ jobs:
run: echo "COMPILED_RUNNERS=compiled_runners" >> $GITHUB_ENV
shell: bash

- if: matrix.os == 'macos' && matrix.cargoargs == '--features build-llvm'
- if: matrix.os == 'macos' && contains(matrix.cargoargs, 'build-llvm')
run: |
brew install llvm@12
echo "LLVM_SYS_120_PREFIX=$(brew --prefix llvm)" >> $GITHUB_ENV
echo 'LDFLAGS="-L/usr/local/opt/llvm@12/lib"' >> $GITHUB_ENV
echo 'CPPFLAGS="-I/usr/local/opt/llvm@12/include"' >> $GITHUB_ENV
- if: matrix.os == 'ubuntu' && matrix.cargoargs == '--features build-llvm'
- if: matrix.os == 'ubuntu' && contains(matrix.cargoargs, 'build-llvm')
run: |
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' -y
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ termcolor = "1.4"
textwrap = { version = "0.16", default-features = false }

sentry = "0.32.2"
jemallocator = "0.5.4"
jemallocator = { version = "0.5.4", optional = true }

[features]
default = ["build-cranelift"]
default = ["build-cranelift", "jemallocator"]
build-cranelift = ["wasmer-compiler-cranelift"]
build-llvm = ["wasmer-compiler-llvm", "inkwell", "llvm-sys-120"]
jemalloc = ["jemallocator"]

[build-dependencies]
wasmer = { version = "2.0", default-features = false, features = ["universal"] }
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod api;
mod display;
mod server;

#[cfg(feature = "jemalloc")]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

Expand Down

0 comments on commit 3b9b35e

Please sign in to comment.