Closed
Description
by robryk:
If I read and write from/to a buffer in such a way that buffer's length remains bounded, but it is never empty, the buffer's underlying byte slice will grow unboundedly. What steps will reproduce the problem? If possible, include a link to a program on play.golang.org. http://play.golang.org/p/SsC896Kwd- runs out of memory, instead of running out of time. What is the expected output? I would expect the buffer to consume a bounded and small amount of memory, as it happens when the buffer occasionally runs dry. I believe this problem is caused by the bytes.Buffer always allocating a larger buffer in grow(n); even if the buffer's capacity is larger than twice the required size.