diff --git a/EngineCore/Cargo.lock b/EngineCore/Cargo.lock index e56a603b..bc04ec89 100644 --- a/EngineCore/Cargo.lock +++ b/EngineCore/Cargo.lock @@ -457,6 +457,11 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fs_extra" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -646,6 +651,25 @@ name = "itoa" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "jemalloc-sys" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jemallocator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -784,6 +808,7 @@ version = "0.1.0" dependencies = [ "cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)", "enet 0.1.0", + "jemallocator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "ngsbase 0.1.0", "ngscom 0.1.0", "ngspf 0.1.0", @@ -2574,6 +2599,7 @@ dependencies = [ "checksum fragile 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ff777830a3bf2d15c62c51a5075bc928d912784c73303db630eecadba9cb5fc" "checksum freetype 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "11926b2b410b469d0e9399eca4cbbe237a9ef02176c485803b29216307e8e028" "checksum fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bcd414e5a1a979b931bb92f41b7a54106d3f6d2e6c253e9ce943b7cd468251ef" +"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures-async-runtime-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "33c03035be1dae627b7e05c6984acb1f2086043fde5249ae51604f1ff20ed037" @@ -2593,6 +2619,8 @@ dependencies = [ "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" +"checksum jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "bfc62c8e50e381768ce8ee0428ee53741929f7ebd73e4d83f669bcf7693e00ae" +"checksum jemallocator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9f0cd42ac65f758063fea55126b0148b1ce0a6354ff78e07a4d6806bc65c4ab3" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" diff --git a/EngineCore/src/ngsengine/Cargo.toml b/EngineCore/src/ngsengine/Cargo.toml index 8ee61c52..52ac19ee 100644 --- a/EngineCore/src/ngsengine/Cargo.toml +++ b/EngineCore/src/ngsengine/Cargo.toml @@ -14,3 +14,7 @@ ngscom = { path = "../ngscom" } ngspf = { path = "../ngspf" } ngspf_com = { path = "../ngspf/src/com" } cgmath = "0.16.1" + +[dependencies.jemallocator] +version = "0.1.9" +features = ["unprefixed_malloc_on_supported_platforms"] diff --git a/EngineCore/src/ngsengine/src/lib.rs b/EngineCore/src/ngsengine/src/lib.rs index 4d49d07d..7f50c797 100644 --- a/EngineCore/src/ngsengine/src/lib.rs +++ b/EngineCore/src/ngsengine/src/lib.rs @@ -6,3 +6,7 @@ mod entry; pub use self::entry::ngsengine_create; + +// Register jemalloc as the global allocator +#[global_allocator] +static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; diff --git a/EngineCore/src/ngsloader/src/lib.rs b/EngineCore/src/ngsloader/src/lib.rs index aaa5b264..ba7dee0b 100644 --- a/EngineCore/src/ngsloader/src/lib.rs +++ b/EngineCore/src/ngsloader/src/lib.rs @@ -12,10 +12,6 @@ //! //! [`ngsengine`]: ../ngsengine/index.html //! -// Use the system allocator - we don't want two instances of jemalloc running -// simultaneously! Besides, we don't care about the allocator's performance here. -#![feature(alloc_system)] -extern crate alloc_system; use ngsbase::INgsProcessorInfo; use ngscom::{hresults, BStringRef, ComPtr, HResult};