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

byteslice.go的使用问题 #364

Closed
zhu121 opened this issue Apr 26, 2022 · 3 comments
Closed

byteslice.go的使用问题 #364

zhu121 opened this issue Apr 26, 2022 · 3 comments
Assignees

Comments

@zhu121
Copy link

zhu121 commented Apr 26, 2022

Please fill out the following system information before opening an issue:

  • OS: win11
  • Go version: 1.18.1
  • gnet version: v2.0.3

What is your question about gnet?
socktoaddr.go的int2decimal函数调用bsPool.Get(32)从sync.Pool取出来使用,但是没看到相应的Put,这样不会造成“泄漏”问题吗

@zhu121 zhu121 added help wanted Extra attention is needed question Further information is requested labels Apr 26, 2022
@panjf2000
Copy link
Owner

这里确实没有 Put 回去,需要修复一下。

@panjf2000 panjf2000 added needs fix and removed help wanted Extra attention is needed question Further information is requested labels Apr 26, 2022
@panjf2000
Copy link
Owner

谢谢指出这个问题~

@lesismal
Copy link

这种size很小并且不需要跨协程传递的buffer,可能直接make([]byte, ...)比较好,因为size小不会导致协程栈扩容和逃逸,局部变量栈pop的时候也就回收了、不用太担心gc或者扩容的高成本

0-haha pushed a commit to 0-haha/gnet that referenced this issue Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants