index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2020-07-07 7:30:22.0 +00:00:00
committer GitHub <noreply@github.com> 2020-07-07 7:30:22.0 +00:00:00
commit
c5accb5e7ded62a28336c16affaef4e9b874c12f [patch]
tree
66344cc10cb62f37b1fb9737735fbbdbaf4661f3
parent
eb30e1114b847021882f7d87d95f0edd8dfa34ef
parent
0fda53f404337d5b6da91fb1ff361e95a44faeb1
download
c5accb5e7ded62a28336c16affaef4e9b874c12f.tar.gz

Merge pull request #22 from joseluisq/feature/jemalloc_allocator

Use jemalloc as global allocator only on Linux Musl

Diff

 Cargo.lock  | 28 ++++++++++++++++++++++++++++
 Cargo.toml  |  7 ++++++-
 src/main.rs |  4 ++++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/Cargo.lock b/Cargo.lock
index a74e981..554a696 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -188,6 +188,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"

[[package]]
name = "fs_extra"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"

[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -332,6 +338,27 @@ dependencies = [
]

[[package]]
name = "jemalloc-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
dependencies = [
 "cc",
 "fs_extra",
 "libc",
]

[[package]]
name = "jemallocator"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
dependencies = [
 "jemalloc-sys",
 "libc",
]

[[package]]
name = "language-tags"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -920,6 +947,7 @@ dependencies = [
 "iron-cors",
 "iron-test",
 "iron_staticfile_middleware",
 "jemallocator",
 "log 0.4.8",
 "nix",
 "openssl",
diff --git a/Cargo.toml b/Cargo.toml
index 44abef3..0bf05a1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,6 +33,9 @@ nix = "0.14"
signal = "0.7"
iron-cors = "0.8"

[target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.jemallocator]
version = "0.3"

[dev-dependencies]
openssl = { version = "0.10", features = ["vendored"] }
hyper = "0.10"
@@ -40,4 +43,6 @@ iron-test = "0.6"
tempdir = "0.3"

[profile.release]
lto = true
lto = "fat"
codegen-units = 1
panic = "abort"
diff --git a/src/main.rs b/src/main.rs
index e4485f0..fcd2e8a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,7 @@
#[cfg(all(target_env = "musl", target_pointer_width = "64"))]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

#[macro_use]
extern crate log;