iai_callgrind::client_requests::memcheck

Function create_block

source
pub fn create_block<T>(addr: *const (), len: usize, desc: T) -> BlockHandle
where T: AsRef<CStr>,
Available on crate feature client_requests_defs only.
Expand description

Create a BlockHandle.

The desc is a std::ffi::CString which is included in any messages pertaining to addresses within the specified memory range. This client request has no other effect on the properties of the memory range.

The specified address range is associated with the desc string. When Memcheck reports invalid access to an address in the range, it will describe it in terms of this block rather than in terms of any other block it knows about. Note that the use of this macro does not actually change the state of memory in any way – it merely gives a name for the range. At some point you may want Memcheck to stop reporting errors in terms of the block named by create_block. To make this possible, create_block returns a BlockHandle. You can pass this BlockHandle to discard. After doing so, Valgrind will no longer relate addressing errors in the specified range to the block.