modernc.org/ccgo/v3@v3.16.14/lib/mem_linux.go (about)

     1  // Copyright 2020 The CCGO Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ccgo // import "modernc.org/ccgo/v3/lib"
     6  
     7  import (
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  var totalRam uint64
    12  
    13  func init() {
    14  	var si unix.Sysinfo_t
    15  	if unix.Sysinfo(&si) != nil {
    16  		return
    17  	}
    18  
    19  	totalRam = uint64(si.Totalram)
    20  }