mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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 gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
|
||||
use gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena;
|
||||
use num_cpus;
|
||||
use rayon;
|
||||
use shared_lock::SharedRwLock;
|
||||
|
@ -33,6 +34,9 @@ fn thread_name(index: usize) -> String {
|
|||
}
|
||||
|
||||
fn thread_startup(index: usize) {
|
||||
unsafe {
|
||||
Gecko_SetJemallocThreadLocalArena(true);
|
||||
}
|
||||
let name = thread_name(index);
|
||||
let name = CString::new(name).unwrap();
|
||||
unsafe {
|
||||
|
@ -44,6 +48,7 @@ fn thread_startup(index: usize) {
|
|||
fn thread_shutdown(_: usize) {
|
||||
unsafe {
|
||||
Gecko_UnregisterProfilerThread();
|
||||
Gecko_SetJemallocThreadLocalArena(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue