aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-10-18 13:38:07 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-10-19 09:52:50 +0200
commit959ce482dd9f2f8c469964b8c258bd3e45f7ca2b (patch)
treeb20d798d3ee0f78ba2f95012e111aaf17bb56462 /components/layout_thread
parent4c538b642e4bdfbf42c522c5a59c258a6d14546e (diff)
downloadservo-959ce482dd9f2f8c469964b8c258bd3e45f7ca2b.tar.gz
servo-959ce482dd9f2f8c469964b8c258bd3e45f7ca2b.zip
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.
Diffstat (limited to 'components/layout_thread')
-rw-r--r--components/layout_thread/Cargo.toml1
-rw-r--r--components/layout_thread/lib.rs5
2 files changed, 4 insertions, 2 deletions
diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml
index 35336e133ca..8683ad60942 100644
--- a/components/layout_thread/Cargo.toml
+++ b/components/layout_thread/Cargo.toml
@@ -40,6 +40,7 @@ script_layout_interface = {path = "../script_layout_interface"}
script_traits = {path = "../script_traits"}
selectors = { path = "../selectors" }
serde_json = "1.0"
+servo_allocator = {path = "../allocator"}
servo_arc = {path = "../servo_arc"}
servo_atoms = {path = "../atoms"}
servo_config = {path = "../config"}
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 0010d66673c..589ee822342 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -39,6 +39,7 @@ extern crate script_layout_interface;
extern crate script_traits;
extern crate selectors;
extern crate serde_json;
+extern crate servo_allocator;
extern crate servo_arc;
extern crate servo_atoms;
extern crate servo_config;
@@ -84,7 +85,7 @@ use layout::webrender_helpers::WebRenderDisplayListConverter;
use layout::wrapper::LayoutNodeLayoutData;
use layout_traits::LayoutThreadFactory;
use libc::c_void;
-use malloc_size_of::{malloc_size_of, MallocSizeOf, MallocSizeOfOps};
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
use msg::constellation_msg::PipelineId;
use msg::constellation_msg::TopLevelBrowsingContextId;
@@ -775,7 +776,7 @@ impl LayoutThread {
let mut reports = vec![];
// Servo uses vanilla jemalloc, which doesn't have a
// malloc_enclosing_size_of function.
- let mut ops = MallocSizeOfOps::new(malloc_size_of, None, None);
+ let mut ops = MallocSizeOfOps::new(::servo_allocator::usable_size, None, None);
// FIXME(njn): Just measuring the display tree for now.
let rw_data = possibly_locked_rw_data.lock();