memsize_darwin.go 419 B

123456789101112131415161718
  1. // Copyright (C) 2014 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. package ur
  7. import "golang.org/x/sys/unix"
  8. func memorySize() int64 {
  9. mem, err := unix.SysctlUint64("hw.memsize")
  10. if err != nil {
  11. return 0
  12. }
  13. return int64(mem)
  14. }