mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
[FIX] Fix the problem of inaccurate host memory
This commit is contained in:
parent
349e6fbc42
commit
e1d03ad65a
@ -69,10 +69,10 @@ func readOS() map[string]string {
|
||||
}
|
||||
|
||||
func getMemory() (total uint64, free uint64) {
|
||||
sysInfo := new(syscall.Sysinfo_t)
|
||||
sysInfo := syscall.Sysinfo_t{}
|
||||
err := syscall.Sysinfo(sysInfo)
|
||||
if err == nil {
|
||||
return sysInfo.Totalram * uint64(syscall.Getpagesize()), sysInfo.Freeram * uint64(syscall.Getpagesize())
|
||||
return uint64(sysInfo.Totalram) * uint64(sysInfo.Unit), sysInfo.Freeram * uint64(syscall.Getpagesize())
|
||||
}
|
||||
return 0, 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user