Closed
Description
Buffers.WriteTo
modifies its receiver (inside consume
), leaving part of the backing array inaccessible. But it can still contain references that pin potentially large buffers into memory, so if the client code continues to hold the remainder of the slice for further use, it may have much higher memory consumption than expected.
The fix is simply to set (v*)[0]
to nil before advancing.