mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Stop relying on linking details of std’s default allocator
We’ve been bitten before by symbol names changing: https://github.com/servo/heapsize/pull/46 and upstream is planning to stop using jemalloc by default: https://github.com/rust-lang/rust/issues/33082#issuecomment-309781465 So use the (relatively) new `#[global_allocator]` attribute to explicitly select the system allocator on Windows and jemalloc (now in an external crate) on other platforms. This choice matches current defaults.
This commit is contained in:
parent
4c538b642e
commit
959ce482dd
20 changed files with 158 additions and 62 deletions
|
@ -354,7 +354,7 @@ impl ReportsForest {
|
|||
|
||||
mod system_reporter {
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
use libc::{c_char, c_void, size_t};
|
||||
use libc::{c_void, size_t};
|
||||
#[cfg(target_os = "linux")]
|
||||
use libc::c_int;
|
||||
use profile_traits::mem::{Report, ReportKind, ReporterRequest};
|
||||
|
@ -460,11 +460,7 @@ mod system_reporter {
|
|||
}
|
||||
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
extern {
|
||||
#[cfg_attr(any(target_os = "macos", target_os = "android"), link_name = "je_mallctl")]
|
||||
fn mallctl(name: *const c_char, oldp: *mut c_void, oldlenp: *mut size_t,
|
||||
newp: *mut c_void, newlen: size_t) -> ::libc::c_int;
|
||||
}
|
||||
use jemalloc_sys::mallctl;
|
||||
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
fn jemalloc_stat(value_name: &str) -> Option<usize> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue