From 07bcfe78801db17085463003ca5f102a0da0834d Mon Sep 17 00:00:00 2001 From: ruokeqx Date: Tue, 16 Jul 2024 19:05:18 +0800 Subject: [PATCH] optimize: reduce func findProcessName mem allocs and copy --- component/process/process_darwin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/component/process/process_darwin.go b/component/process/process_darwin.go index 67d2e833..c02771ed 100644 --- a/component/process/process_darwin.go +++ b/component/process/process_darwin.go @@ -46,12 +46,12 @@ func findProcessName(network string, ip netip.Addr, port int) (uint32, string, e isIPv4 := ip.Is4() - value, err := syscall.Sysctl(spath) + value, err := unix.SysctlRaw(spath) if err != nil { return 0, "", err } - buf := []byte(value) + buf := value itemSize := structSize if network == TCP { // rup8(sizeof(xtcpcb_n))