Skip to content
This repository was archived by the owner on May 28, 2022. It is now read-only.

Commit 7b2875e

Browse files
committed
Change the global allocators used by dylibs
jemalloc was removed from the standard library recently: <rust-lang/rust#55238> Removed `extern crate alloc_system;` from `ngsloader` because this is the current default choice. `ngsengine` explicitly registers jemalloc (provided by the `jemallocator` crate) as the global allocator for optimal runtime performance.
1 parent 8f25e20 commit 7b2875e

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

EngineCore/Cargo.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EngineCore/src/ngsengine/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ ngscom = { path = "../ngscom" }
1414
ngspf = { path = "../ngspf" }
1515
ngspf_com = { path = "../ngspf/src/com" }
1616
cgmath = "0.16.1"
17+
18+
[dependencies.jemallocator]
19+
version = "0.1.9"
20+
features = ["unprefixed_malloc_on_supported_platforms"]

EngineCore/src/ngsengine/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66
mod entry;
77

88
pub use self::entry::ngsengine_create;
9+
10+
// Register jemalloc as the global allocator
11+
#[global_allocator]
12+
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

EngineCore/src/ngsloader/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
//!
1313
//! [`ngsengine`]: ../ngsengine/index.html
1414
//!
15-
// Use the system allocator - we don't want two instances of jemalloc running
16-
// simultaneously! Besides, we don't care about the allocator's performance here.
17-
#![feature(alloc_system)]
18-
extern crate alloc_system;
1915
2016
use ngsbase::INgsProcessorInfo;
2117
use ngscom::{hresults, BStringRef, ComPtr, HResult};

0 commit comments

Comments
 (0)