Bug 1361258 - Opt-in to thread-local jemalloc arenas for stylo rayon threads. r=bholley

This commit is contained in:
Mike Hommey 2017-05-11 12:01:41 +09:00 committed by Mike Hommey
parent b0f640b5a9
commit 6818cdb249

View file

@ -6,6 +6,7 @@
use context::StyleSystemOptions; use context::StyleSystemOptions;
use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread}; use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
use gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena;
use num_cpus; use num_cpus;
use rayon; use rayon;
use shared_lock::SharedRwLock; use shared_lock::SharedRwLock;
@ -33,6 +34,9 @@ fn thread_name(index: usize) -> String {
} }
fn thread_startup(index: usize) { fn thread_startup(index: usize) {
unsafe {
Gecko_SetJemallocThreadLocalArena(true);
}
let name = thread_name(index); let name = thread_name(index);
let name = CString::new(name).unwrap(); let name = CString::new(name).unwrap();
unsafe { unsafe {
@ -44,6 +48,7 @@ fn thread_startup(index: usize) {
fn thread_shutdown(_: usize) { fn thread_shutdown(_: usize) {
unsafe { unsafe {
Gecko_UnregisterProfilerThread(); Gecko_UnregisterProfilerThread();
Gecko_SetJemallocThreadLocalArena(false);
} }
} }