sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

optimize: reduce func findProcessName mem allocs and copy

Open ruokeqx opened this issue 7 months ago • 0 comments

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.

ruokeqx avatar Jul 16 '24 12:07 ruokeqx