diff options
| author | Gus Wynn <guswynn@gmail.com> | 2021-04-04 14:07:56 -0700 |
|---|---|---|
| committer | Gus Wynn <guswynn@gmail.com> | 2021-04-04 14:10:26 -0700 |
| commit | 3965773ae7743e051070b4eed3c6e02e9df3b25c (patch) | |
| tree | cab824310bbf8fa5fbfb88c65ff7cab53be62a4d /compiler/rustc/src | |
| parent | 8ad6a443cfee83e1f7d29c9ec0de26143c54a617 (diff) | |
| download | rust-3965773ae7743e051070b4eed3c6e02e9df3b25c.tar.gz rust-3965773ae7743e051070b4eed3c6e02e9df3b25c.zip | |
use jemallocator in rustc/rustdoc
Diffstat (limited to 'compiler/rustc/src')
| -rw-r--r-- | compiler/rustc/src/main.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/rustc/src/main.rs b/compiler/rustc/src/main.rs index 859028957db..c80fab99496 100644 --- a/compiler/rustc/src/main.rs +++ b/compiler/rustc/src/main.rs @@ -1,3 +1,16 @@ +// Configure jemalloc as the `global_allocator` when configured. This is +// so that we use the sized deallocation apis jemalloc provides +// (namely `sdallocx`). +// +// The symbol overrides documented below are also performed so that we can +// ensure that we use a consistent allocator across the rustc <-> llvm boundary +#[cfg(feature = "jemalloc")] +#[global_allocator] +static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + +#[cfg(feature = "tikv-jemalloc-sys")] +use tikv_jemalloc_sys as jemalloc_sys; + fn main() { // Pull in jemalloc when enabled. // @@ -7,7 +20,7 @@ fn main() { // dynamic libraries. That means to pull in jemalloc we actually need to // reference allocation symbols one way or another (as this file is the only // object code in the rustc executable). - #[cfg(feature = "jemalloc-sys")] + #[cfg(feature = "tikv-jemalloc-sys")] { use std::os::raw::{c_int, c_void}; |
