[Feature] use SysctlRaw to findProcessName to reduce mem allocs and copy
ruokeqx opened this issue · comments
Verify steps
- 我已经在 Issue Tracker 中找过我要提出的请求 I have searched on the issue tracker for a related feature request.
- 我已经仔细看过 Documentation 并无法找到这个功能 I have read the documentation and was unable to solve the issue.
Description
syscall.Sysctl
make a slice byte buf and convert to string when return.
func findProcessName
convert string to slice byte again.
This malloc and copy mem twice unnecessarily.
net.inet.tcp.pcblist_n
usually not a small piece of mem, and copy twice would cause mem waste.
Use golang.org/x/sys/unix.SysctlRaw
instead.
Possible Solution
No response