mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Bug 1361258 - Opt-in to thread-local jemalloc arenas for stylo rayon threads. r=bholley
This commit is contained in:
parent
b0f640b5a9
commit
6818cdb249
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue