iai_callgrind::client_requests::valgrind

Function resizeinplace_block

source
pub fn resizeinplace_block(
    addr: *const (),
    old_size: usize,
    new_size: usize,
    redzone: usize,
)
Available on crate feature client_requests_defs only.
Expand description

resizeinplace_block informs a tool about reallocation.

The following description is taken almost untouched from the docs in the valgrind.h header file.

For Memcheck, it does four things:

  • It records that the size of a block has been changed. This assumes that the block was annotated as having been allocated via malloclike_block. Otherwise, an error will be issued.
  • If the block shrunk, it marks the freed memory as being unaddressable.
  • If the block grew, it marks the new area as undefined and defines a red zone past the end of the new block.
  • The V-bits of the overlap between the old and the new block are preserved.

resizeinplace_block should be put after allocation of the new block and before deallocation of the old block.

See also malloclike_block for more details