Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetMemoryStat func() (*mem.VirtualMemoryStat, error) = mem.VirtualMemory
GetMemoryStat 获取当前瞬间的内存状态.
PS: (1) Total = Available + Used
Functions ¶
func MemoryStatToString ¶
func MemoryStatToString(stat *mem.VirtualMemoryStat) string
MemoryStatToString
e.g. () => "total: 32 GiB, available: 18 GiB, used: 14 GiB, free: 9.9 GiB, used percent: 43.06%", nil
func SetSoftMemoryLimit ¶
SetSoftMemoryLimit 软内存限制(soft memory limit)
PS: (1) This limit will be respected even if GOGC=off (or, if SetGCPercent(-1) is executed). (2) 默认memory limit是math.MaxInt64(即第一次调用debug.SetMemoryLimit()的返回值为math.MaxInt64).
@param limit 单位: B(byte;字节) @return 之前的内存限制
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.