Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarshalToWriter does not pool buffers since Go 1.17 #359

Open
martin-sucha opened this issue Feb 20, 2022 · 0 comments
Open

MarshalToWriter does not pool buffers since Go 1.17 #359

martin-sucha opened this issue Feb 20, 2022 · 0 comments

Comments

@martin-sucha
Copy link

Go 1.17 changed the behavior of net.Buffers in golang/go#45163. This causes code at

easyjson/buffer/pool.go

Lines 171 to 180 in 11c9d7f

bufs := net.Buffers(b.bufs)
if len(b.Buf) > 0 {
bufs = append(bufs, b.Buf)
}
n, err := bufs.WriteTo(w)
for _, buf := range b.bufs {
putBuf(buf)
}
putBuf(b.toPool)

to not put buffers back to the pool.
Argument to putBuf is nil because WriteTo sets all elements of the b.bufs slice to nil.

@mailru mailru deleted a comment from misha456gggg Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant