mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
auto merge of #4927 : Ms2ger/servo/mem, r=jdm
This commit is contained in:
commit
52fc01ad37
1 changed files with 18 additions and 10 deletions
|
@ -10,7 +10,6 @@ use std::ffi::CString;
|
||||||
use std::old_io::timer::sleep;
|
use std::old_io::timer::sleep;
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
use std::old_io::File;
|
use std::old_io::File;
|
||||||
use std::mem;
|
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
use std::env::page_size;
|
use std::env::page_size;
|
||||||
|
@ -213,16 +212,25 @@ fn get_jemalloc_stat(value_name: &str) -> Option<u64> {
|
||||||
let value_ptr = &mut value as *mut _ as *mut c_void;
|
let value_ptr = &mut value as *mut _ as *mut c_void;
|
||||||
let mut value_len = size_of::<size_t>() as size_t;
|
let mut value_len = size_of::<size_t>() as size_t;
|
||||||
|
|
||||||
let mut rv: c_int;
|
// Using the same values for the `old` and `new` parameters is enough
|
||||||
unsafe {
|
// to get the statistics updated.
|
||||||
// Using the same values for the `old` and `new` parameters is enough
|
let rv = unsafe {
|
||||||
// to get the statistics updated.
|
je_mallctl(epoch_c_name.as_ptr(), epoch_ptr, &mut epoch_len, epoch_ptr,
|
||||||
rv = je_mallctl(epoch_c_name.as_ptr(), epoch_ptr, &mut epoch_len, epoch_ptr, epoch_len);
|
epoch_len)
|
||||||
if rv == 0 {
|
};
|
||||||
rv = je_mallctl(value_c_name.as_ptr(), value_ptr, &mut value_len, null_mut(), 0);
|
if rv != 0 {
|
||||||
}
|
return None;
|
||||||
}
|
}
|
||||||
if rv == 0 { Some(value as u64) } else { None }
|
|
||||||
|
let rv = unsafe {
|
||||||
|
je_mallctl(value_c_name.as_ptr(), value_ptr, &mut value_len,
|
||||||
|
null_mut(), 0)
|
||||||
|
};
|
||||||
|
if rv != 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(value as u64)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like std::macros::try!, but for Option<>.
|
// Like std::macros::try!, but for Option<>.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue