mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-16 09:42:21 +08:00
19 lines
340 B
Go
19 lines
340 B
Go
//go:build darwin
|
|
|
|
package libbox
|
|
|
|
import (
|
|
runtimeDebug "runtime/debug"
|
|
|
|
"github.com/sagernet/sing-box/common/dialer/conntrack"
|
|
)
|
|
|
|
const memoryLimit = 30 * 1024 * 1024
|
|
|
|
func SetMemoryLimit() {
|
|
runtimeDebug.SetGCPercent(10)
|
|
runtimeDebug.SetMemoryLimit(memoryLimit)
|
|
conntrack.KillerEnabled = true
|
|
conntrack.MemoryLimit = memoryLimit
|
|
}
|