call decay prior to purge for trim-memory
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
5be07ebc0f
commit
b5c167de12
1 changed files with 9 additions and 3 deletions
|
@ -141,12 +141,14 @@ pub mod this_thread {
|
||||||
static DEALLOCATED_BYTES: OnceCell<&'static u64> = const { OnceCell::new() };
|
static DEALLOCATED_BYTES: OnceCell<&'static u64> = const { OnceCell::new() };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn idle() -> Result { super::notify(&mallctl!("thread.idle")) }
|
pub fn trim() -> Result { decay().and_then(|()| purge()) }
|
||||||
|
|
||||||
pub fn trim() -> Result { notify(mallctl!("arena.0.purge")) }
|
pub fn purge() -> Result { notify(mallctl!("arena.0.purge")) }
|
||||||
|
|
||||||
pub fn decay() -> Result { notify(mallctl!("arena.0.decay")) }
|
pub fn decay() -> Result { notify(mallctl!("arena.0.decay")) }
|
||||||
|
|
||||||
|
pub fn idle() -> Result { super::notify(&mallctl!("thread.idle")) }
|
||||||
|
|
||||||
pub fn flush() -> Result { super::notify(&mallctl!("thread.tcache.flush")) }
|
pub fn flush() -> Result { super::notify(&mallctl!("thread.tcache.flush")) }
|
||||||
|
|
||||||
pub fn set_muzzy_decay(decay_ms: isize) -> Result<isize> {
|
pub fn set_muzzy_decay(decay_ms: isize) -> Result<isize> {
|
||||||
|
@ -239,7 +241,11 @@ pub fn is_prof_enabled() -> Result<bool> {
|
||||||
get::<u8>(&mallctl!("prof.active")).map(is_nonzero!())
|
get::<u8>(&mallctl!("prof.active")).map(is_nonzero!())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trim<I: Into<Option<usize>>>(arena: I) -> Result {
|
pub fn trim<I: Into<Option<usize>> + Copy>(arena: I) -> Result {
|
||||||
|
decay(arena).and_then(|()| purge(arena))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn purge<I: Into<Option<usize>>>(arena: I) -> Result {
|
||||||
notify_by_arena(arena.into(), mallctl!("arena.4096.purge"))
|
notify_by_arena(arena.into(), mallctl!("arena.4096.purge"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue