BUF_SHRINK(3) - Library Functions Manual
buf_shrink - reduce the buffer to its minimal requirement
buf_shrink(struct buf *b);
Reduce the buffer capacity specified by b to reduce memory usage.
The buf_shrink() function will reduce the buffer capacity to the exact buffer length. If reallocation of the new memory region failed, the current buffer is kept and its capacity is unchanged. As such, it is perfectly safe to ignore the return value unless you really want to reduce memory consumption
If the buffer’s length is 0, the function simply frees the underlying data and return true.
Otherwise the buf_shrink() function returns false in case of error and errno is set to indicate the error.
Memory reallocation failed.
The libbuf library was written by David Demelier <email@example.com>
macOS 11.2 - October 29, 2019-2020