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

Commit

Permalink
Change the global allocators used by dylibs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yvt committed Nov 8, 2018
1 parent 8f25e20 commit 7b2875e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
28 changes: 28 additions & 0 deletions EngineCore/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions EngineCore/src/ngsengine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 4 additions & 0 deletions EngineCore/src/ngsengine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 0 additions & 4 deletions EngineCore/src/ngsloader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 7b2875e

Please sign in to comment.