Skip to content

hackur/memory-monitor

Repository files navigation

Memory Monitor

A lightweight macOS menu bar app for live memory monitoring with an interactive pie chart.

Memory Monitor Screenshot

Features

System Overview

  • Memory usage with percentage ring (color-coded by pressure)
  • Memory pressure indicator — Normal (green), Elevated (yellow), Critical (red)
  • Free memory and compressed memory stats
  • Updates every 1.5 seconds

Memory Breakdown Bar

Visual breakdown of system memory:

  • App (blue) — Memory used by applications
  • Wired (red) — Memory that can't be paged out
  • Compressed (orange) — Memory compressed to save space
  • Cached (yellow) — File cache (reclaimable)

Process Monitoring

  • View top 8, 15, or 30 apps by memory usage
  • Pie chart view — Visual breakdown with hover-to-inspect
  • List view — Compact scrollable list for more apps
  • Shows app icon, memory usage, thread count, and percentage
  • Click any app for detailed process info

Process Details (click to drill down)

  • Resident memory (actual RAM used)
  • Virtual memory (address space)
  • Thread count
  • Open file descriptors
  • Memory regions
  • Page faults / page ins
  • Parent PID
  • Running time (uptime)
  • Bundle ID and full path (copyable)
  • Quick link to Activity Monitor

View Controls

  • Chart / List toggle — Switch between pie chart and list-only view
  • 8 / 15 / 30 picker — Show more or fewer processes
  • Mouse tracking on pie chart — hover to highlight slices

Build

cd /Volumes/JS-DEV/memory-monitor
./build.sh

Output: build/MemoryMonitor.app

Run

open build/MemoryMonitor.app

Or double-click the app in Finder.

Install (Auto-start on Login)

cp -r build/MemoryMonitor.app /Applications/

Then add to Login Items in System Settings → General → Login Items.

Requirements

  • macOS 12.0+ (Monterey or later)
  • Apple Silicon (M1/M2/M3) or Intel

Architecture

memory-monitor/
├── MemoryMonitorApp.swift   # App entry point, menu bar setup
├── MemoryMonitor.swift      # Memory stats + process monitoring
├── MenuBarView.swift        # All UI views (main, detail, pie chart)
├── BridgingHeader.h         # Darwin API imports
├── Info.plist               # App configuration
└── build.sh                 # Build script

Technical Details

  • Language: Swift 5.9+ / SwiftUI
  • APIs: Darwin (proc_pidinfo, host_statistics64, vm_statistics64)
  • Mouse tracking: NSTrackingArea via NSViewRepresentable
  • Memory footprint: ~25 MB
  • CPU usage: <1%
  • No network access — pure local monitoring
  • No special permissions — uses standard system APIs

Customization

In MemoryMonitor.swift:

  • updateInterval — Refresh rate (default: 1.5s)
  • processLimit — Default number of processes (default: 8)

In MenuBarView.swift:

  • Colors, layout, animations
  • Process count options in ProcessCount enum

Future Ideas

  • CPU usage monitoring
  • Network speed monitor
  • Disk usage
  • Click to force-quit apps
  • Memory usage alerts/notifications
  • Historical graphs
  • Export to CSV

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors