mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-26 20:29:03 +03:00
Add ios memory limit
This commit is contained in:
@@ -20,7 +20,7 @@ func readStatus() StatusMessage {
|
||||
var memStats runtime.MemStats
|
||||
runtime.ReadMemStats(&memStats)
|
||||
var message StatusMessage
|
||||
message.Memory = int64(memStats.HeapInuse + memStats.StackInuse + memStats.MSpanInuse)
|
||||
message.Memory = int64(memStats.Sys - memStats.HeapReleased)
|
||||
message.Goroutines = int32(runtime.NumGoroutine())
|
||||
return message
|
||||
}
|
||||
|
||||
8
experimental/libbox/memory.go
Normal file
8
experimental/libbox/memory.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package libbox
|
||||
|
||||
import "runtime/debug"
|
||||
|
||||
func SetMemoryLimit() {
|
||||
debug.SetGCPercent(10)
|
||||
debug.SetMemoryLimit(30 * 1024 * 1024)
|
||||
}
|
||||
Reference in New Issue
Block a user