Skip to content

Latest commit

 

History

History
60 lines (55 loc) · 3.35 KB

README.ShowMemory.md

File metadata and controls

60 lines (55 loc) · 3.35 KB

ShowMemory

A (set of) Tool/Script(s) To Show/Display Free/Used/Total/etc Memory/RAM Amount/Size, on macOS/macOSX, BSD/Unix, etc.
Later Linux support will be added. Later GUI tool will be added.

License(s):

ShowMemory.sh - ShowMemory - it shows Free/Used/Total/etc RAM/Memory Size/Amount.
Copyright © 2020 Erik T Ashfolk (<atErïk@ÖυťĹöōķ·ċōm;atErïk@AśhFölķ·ćōm>, Do Not Copy
  Eml-Adrs, Type in English/basic-latin char, No Soliciting Permitted). All rights reserved.
Released with below License(s)+Restrictions+Permissions:
 (*) Do Not Use My/Our Contribution(s) To Kill/Harm/Violate(or Steal-from)(Any) Human/Community,Earth,etc.
 (*) GNU General Public License v3 (GPL v3) https://www.GNU.org/licenses/gpl-3.0.en.html

 (Written initially on 2020-06-24 by Erik T Ashfolk).

 (All other trademarks, etc cited here are the property of their respective owners.)
 (All other copyright items cited here are the copyright of their respective author/creator.)

Info:

Currently the "ShowMemory.sh" is a bash-shell based script/tool, & for macOSX.

I'm/We're now calculating memory size/amount in this way : by getting data from output of "vm_stat" command, unfortunately its not super accurate now. If you want to correct me/us/source further, pls don't hesitate to create an "Issue" under this "ShowMemory" repo/project with your info & link, Thanks in advance. Currently, we're using below specific data fields from "vm_stat", to get the total for a specific category of memory:
Abbreviations : pg = Page (each page is 4096 bytes) . 1048576 is Bytes in 1MB(MegaBytes) . Purgbl = Purgeable . WirdDn = Wired Down . FileBkd = File-backed . Actv = Active . Cmprsr = Occupied by Compressor .
"CATEGORY OF MEMORY : MB (MegaBytes)"
"Free (Physical/RAM) Memory = ( $pgFree * $pgSize ) / 1048576 "
"Purgeable (Physical/RAM) Memory = ( $pgPurgbl * $pgSize ) / 1048576 "
"Cached (Physical/RAM) Memory = ( $pgFileBkd * $pgSize ) / 1048576 "
"Used (Physical/RAM) Memory = (( $pgActv + $pgWirdDn + $pgCmprsr ) * $pgSize ) / 1048576 "
"Total (Physical/RAM) Memory = ( $totalPhysicalMem * $pgSize ) / 1048576 "

Tested-on/Supported Platform(s):

Script/tool was tested, it Worked.

Tested on:
Mac:~ atErik$ uname -a
Darwin Mac.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
Mac:~ atErik$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
Mac:~ atErik$ sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
Mac:~ atErik$ zsh --version
zsh 5.7.1 (x86_64-apple-darwin19.0)

How To Use/Run:

Any executable file needs the "Execute" attribute bit set, & if thats not done already:
execute below command in CLI "Terminal"/shell:
  chmod  +x  ShowMemory.sh
  ./ShowMemory.sh
  (above command will show memory stat/info on screen)