memory_other.go raw

   1  //go:build !linux && !(js && wasm)
   2  
   3  package ratelimit
   4  
   5  // ReadProcessMemoryStats returns memory statistics using Go runtime stats.
   6  // On non-Linux platforms, we cannot read /proc/self/status, so we approximate
   7  // using the Go runtime's memory statistics.
   8  //
   9  // Note: This is less accurate than the Linux implementation because:
  10  // - runtime.MemStats.Sys includes memory reserved but not necessarily resident
  11  // - We cannot distinguish shared vs anonymous memory
  12  // - The values may not match what the OS reports for the process
  13  func ReadProcessMemoryStats() ProcessMemoryStats {
  14  	return readProcessMemoryStatsFallback()
  15  }
  16