iai_callgrind::client_requests::valgrind

Function mempool_trim

source
pub fn mempool_trim(pool: *const (), addr: *const (), size: usize)
Available on crate feature client_requests_defs only.
Expand description

Disassociate any pieces outside a particular range

This request trims the chunks associated with pool. The request only operates on chunks associated with pool. Trimming is formally defined as:

All chunks entirely inside the range addr..(addr+size-1) are preserved.

All chunks entirely outside the range addr..(addr+size-1) are discarded, as though mempool_free was called on them.

All other chunks must intersect with the range addr..(addr+size-1); areas outside the intersection are marked as NOACCESS, as though they had been independently freed with mempool_free.

This is a somewhat rare request, but can be useful in implementing the type of mass-free operations common in custom LIFO allocators.

See also Memory Pools: describing and working with custom allocators