pub unsafe extern "C" fn malloc_usable_size(
    ptr: *const c_void
) -> size_t
Expand description

Returns the real size of the previously-allocated memory region referenced by ptr.

The value may be larger than the size requested on allocation.

Although the excess bytes can be overwritten by the application without ill effects, this is not good programming practice: the number of excess bytes in an allocation depends on the underlying implementation.

The main use of this function is for debugging and introspection.

Errors

If ptr is null, 0 is returned.

Safety

The behavior is undefined if:

  • ptr does not match a pointer earlier returned by the memory allocation functions of this crate, or
  • the memory region referenced by ptr has been deallocated.