MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.

Home Page:https://wiki.metacubex.one

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] use SysctlRaw to findProcessName to reduce mem allocs and copy

ruokeqx opened this issue · comments

Verify steps

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