On Thu, Jun 11, 2020 at 6:50 PM Gautam Saha <gautam.s...@gmail.com> wrote: > > Trying to allocate an in-memory buff of small size (few bytes) using > bytes.NewBuffer(make([]byte, 0, <some size >)) > The allocated buffer has size 4096 bytes i.e. > than what I requested for. > Why is this so?
Nowhere the docs say one can control the buffer size. Instead, the passed []byte is documented to be used "as its initial contents", not "as its initial buffer". -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-WByFmqUX8LhY7878hZ1kFQDDdd2%2BF%3DTt2QjL%3Dg4C%3DPmQ%40mail.gmail.com.