Source File
memory_linux.go
Belonging Package
github.com/pbnjay/memory
// +build linuxpackage memoryimportfunc sysTotalMemory() uint64 {:= &syscall.Sysinfo_t{}:= syscall.Sysinfo()if != nil {return 0}// If this is a 32-bit system, then these fields are// uint32 instead of uint64.// So we always convert to uint64 to match signature.return uint64(.Totalram) * uint64(.Unit)}func sysFreeMemory() uint64 {:= &syscall.Sysinfo_t{}:= syscall.Sysinfo()if != nil {return 0}// If this is a 32-bit system, then these fields are// uint32 instead of uint64.// So we always convert to uint64 to match signature.return uint64(.Freeram) * uint64(.Unit)}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |