3 ms·
> it also breaks many formerly-well-defined programs that use `malloc_usable_size` Does it? According to the documentation for malloc_reusable_size, it can be
by usefulcat 2y ago
> it also breaks many formerly-well-defined programs that use `malloc_usable_size`
Does it? According to the documentation for malloc_reusable_size, it can be used to find out the actual size of an allocation, but you still have to call realloc before writing to bytes beyond the size passed to malloc.
"This function is intended to only be used for diagnostics
and statistics; writing to the excess memory without first
calling realloc(3) to resize the allocation is not supported."
- o11c 2y agoYes, that's what the documentation has been retroactively changed to say. It used to say that the memory was usable immediately. Also, `realloc` is not guaranteed to actually operate in-place.