diff --git a/src/core/alloc/je.rs b/src/core/alloc/je.rs index 81fbd3ea..6bdf8b33 100644 --- a/src/core/alloc/je.rs +++ b/src/core/alloc/je.rs @@ -141,12 +141,14 @@ pub mod this_thread { 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 idle() -> Result { super::notify(&mallctl!("thread.idle")) } + pub fn flush() -> Result { super::notify(&mallctl!("thread.tcache.flush")) } pub fn set_muzzy_decay(decay_ms: isize) -> Result { @@ -239,7 +241,11 @@ pub fn is_prof_enabled() -> Result { get::(&mallctl!("prof.active")).map(is_nonzero!()) } -pub fn trim>>(arena: I) -> Result { +pub fn trim> + Copy>(arena: I) -> Result { + decay(arena).and_then(|()| purge(arena)) +} + +pub fn purge>>(arena: I) -> Result { notify_by_arena(arena.into(), mallctl!("arena.4096.purge")) }