github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/storage/mem.go (about)

     1  //go:build !linux
     2  // +build !linux
     3  
     4  package storage
     5  
     6  import (
     7  	"github.com/shirou/gopsutil/mem"
     8  )
     9  
    10  // on linux we also look at cgroup mem limit
    11  func getMemTotal() (uint64, error) {
    12  	vm, err := mem.VirtualMemory()
    13  	if err != nil {
    14  		return 0, err
    15  	}
    16  
    17  	return vm.Total, nil
    18  }