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
internal/poll: use noescape or reuse iovec obj in Writev to avoid alloc mem in heap every time #26663
Comments
Unfortunately the Maybe we could put a few |
@randall77 Since
it work well and without gc any more. and latency is deduce and qps is increase in my project. |
I don't see how that change prevents the escape of the chunks. |
Note that the The real problem here is that (There's also the issue that Writev() should only cause the |
Change https://golang.org/cl/172419 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOOS="linux"
What did you do?
I use writev to write buffer into tcpconn. in order to reduce gc, I try to reuse object as far as possible.
and i did it so. but when i run go tool pprof to analysis of the memory。I found Writev alloc memory every time is called.
and the go tool pprof show:
as pprof showed. almost all memory was alloced by Writev
analysis of the object escape
At line42 it show &chunk[0] is escapes to heap.and in pprof it alloc mem every time.
it is that possilbe to make noescape to avoid obj alloc in heap or reuse these obj to avoid gc?
What did you expect to see?
the iovec object should be alloced in stack in oder to avoid gc, but it escaped to heap.
What did you see instead?
iovec was escape to heap and alloc mem every time and made gc frequently.
The text was updated successfully, but these errors were encountered: