doc.go raw

   1  // Package memory provides a single method reporting total system memory
   2  // accessible to the kernel.
   3  package memory
   4  
   5  // TotalMemory returns the total accessible system memory in bytes.
   6  //
   7  // The total accessible memory is installed physical memory size minus reserved
   8  // areas for the kernel and hardware, if such reservations are reported by
   9  // the operating system.
  10  //
  11  // If accessible memory size could not be determined, then 0 is returned.
  12  func TotalMemory() uint64 {
  13  	return sysTotalMemory()
  14  }
  15  
  16  // FreeMemory returns the total free system memory in bytes.
  17  //
  18  // The total free memory is installed physical memory size minus reserved
  19  // areas for other applications running on the same system.
  20  //
  21  // If free memory size could not be determined, then 0 is returned.
  22  func FreeMemory() uint64 {
  23  	return sysFreeMemory()
  24  }
  25