GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - madelinehebert/memory: A go function to report total system memory

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

23 Commits
23 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
README.md
README.md
 
 
doc.go
doc.go
 
 
example_test.go
example_test.go
 
 
go.mod
go.mod
 
 
memory_bsd.go
memory_bsd.go
 
 
memory_darwin.go
memory_darwin.go
 
 
memory_linux.go
memory_linux.go
 
 
memory_test.go
memory_test.go
 
 
memory_windows.go
memory_windows.go
 
 
memsysctl.go
memsysctl.go
 
 
stub.go
stub.go
 
 

Repository files navigation

memory

Package memory provides two methods reporting total physical system memory accessible to the kernel, and free memory available to the running application.

This package has no external dependency besides the standard library and default operating system tools.

Documentation: GoDoc

This is useful for dynamic code to minimize thrashing and other contention, similar to the stdlib runtime.NumCPU See some history of the proposal at golang/go#21816

Example

fmt.Printf("Total system memory: %d\n", memory.TotalMemory())
fmt.Printf("Free memory: %d\n", memory.FreeMemory())

Testing

Tested/working on:

  • macOS 10.12.6 (16G29), 10.15.7 (19H2)
  • Windows 10 1511 (10586.1045)
  • Linux RHEL (3.10.0-327.3.1.el7.x86_64)
  • Raspberry Pi 3 (ARMv8) on Raspbian, ODROID-C1+ (ARMv7) on Ubuntu, C.H.I.P (ARMv7).
  • Amazon Linux 2 aarch64 (m6a.large, 4.14.203-156.332.amzn2.aarch64)

Tested on virtual machines:

  • Windows 7 SP1 386
  • Debian stretch 386
  • NetBSD 7.1 amd64 + 386
  • OpenBSD 6.1 amd64 + 386
  • FreeBSD 11.1 amd64 + 386
  • DragonFly BSD 4.8.1 amd64

If you have access to untested systems please test and report success/bugs.

About

A go function to report total system memory

Resources

Readme
License
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.