Buffer

trimToSize() [Buffer class]

Reduce the memory allocation for the buffer.

// PROTOTYPE
bool trimToSize()

This cannot be used to make the allocated buffer larger. See reserve().

It is possible to reserve additional bytes at the end of the buffer that are larger than the data size. This call removes these bytes. It's normally not necessary to use this, as the size is separate from capacity and you will normally use the size.

Normally you will use resize() to change the number of bytes used; this call is only for affecting the underlying memory used.