Open johanbrandhorst opened 1 week ago
Hi!
staticcheck flags the use of sync.Pool in server.go as incorrect, as it's passing []byte instead of *[]byte, which means every instance ends up allocating a slice header. See https://staticcheck.dev/docs/checks/#SA6002 and https://go-review.googlesource.com/c/go/+/24371 for more information, discussion and examples.
staticcheck
sync.Pool
server.go
[]byte
*[]byte
To fix it, I suggest changing instances of Put to pass a reference to the slice, and to ensure that the same alloc that was got is put back.
Put
Hi!
staticcheck
flags the use ofsync.Pool
inserver.go
as incorrect, as it's passing[]byte
instead of*[]byte
, which means every instance ends up allocating a slice header. See https://staticcheck.dev/docs/checks/#SA6002 and https://go-review.googlesource.com/c/go/+/24371 for more information, discussion and examples.To fix it, I suggest changing instances of
Put
to pass a reference to the slice, and to ensure that the same alloc that was got is put back.