Blog: linux utilities

Snap Ram Monitor

Get it from the Snap Store

🖥️ RAM Monitor: Preventing Linux Freezes Before They Happen

The Problem I Discovered

After years of using Linux as my daily driver, I found a critical flaw: Linux has no built-in mechanism to prevent memory exhaustion. Here's my story:

  • Cursor Editor (my favorite code editor) gradually fills up RAM during long coding sessions
  • Ubuntu provides no warnings until memory hits 95%+
  • System becomes completely unresponsive - frozen, unusable, requiring hard reset
  • Simple solution exists: Restart Cursor to flush memory, but you need advance warning

The Solution: RAM Monitor

I built a lightweight snap package that monitors RAM usage and sends desktop notifications before disaster strikes.

Key Features

  • 🔄 Continuous monitoring every 60 seconds
  • 🔔 Desktop notifications when threshold exceeded
  • ⚙️ Configurable alerts (default 80%, customizable via environment variables)
  • 🔧 Systemd daemon - runs automatically after install
  • 📦 Snap packaged - works on Ubuntu and compatible distributions

Installation

sudo snap install ram-monitor

Usage

# Monitor with default 80% threshold
snap run ram-monitor.ram-monitor

# Custom threshold (e.g., 70%)
RAM_THRESHOLD=70 snap run ram-monitor.ram-monitor

# Make permanent
echo 'export RAM_THRESHOLD=75' >> ~/.bashrc

Why This Matters

Memory management is crucial for developer productivity: - 💻 Prevent lost work from system freezes - 🕐 Save time vs. waiting for hard resets - 🎯 Stay productive during long coding sessions - 🐧 Addresses Linux limitation in memory monitoring

Technical Details

  • Language: Bash script
  • Monitoring: /proc/meminfo parsing
  • Notifications: libnotify integration
  • Packaging: Snap (universal Linux packages)
  • Resource usage: < 1MB RAM, < 0.1% CPU

Open Source

The code is available on GitHub with comprehensive documentation: - 📖 Full README: Installation, configuration, troubleshooting - 🔧 Development guide: How to build and contribute - 📦 Snap packaging: Ready for distribution

Repository: https://github.com/djordjep/ram-monitor-snap

The Bigger Picture

This experience taught me about Linux memory management limitations. While tools like htop exist for monitoring, they require active user attention. RAM Monitor provides passive, automatic protection - exactly what developers need for uninterrupted workflow.

Available now on Snap Store: sudo snap install ram-monitor


Release Description for v0.2.0

🎯 What This Release Solves

After extensive testing and 6 failed snap releases, we discovered fundamental limitations with Snap packaging that prevented the RAM monitor from working reliably:

Snap Limitations Discovered: - System daemons cannot access user desktop sessions (notifications fail) - User daemons require experimental flags (experimental.user-daemons=true) - Autostart helpers don't work consistently across desktop environments - Result: App appeared to install but never actually monitored or notified

✅ The Solution: .deb Package

v0.2.0 introduces .deb packaging with systemd user service - the standard Linux approach that actually works:

# Download and install
wget https://github.com/djordjep/ram-monitor-snap/releases/download/v0.2.0/ram-monitor_0.2.0_amd64.deb
sudo dpkg -i ram-monitor_0.2.0_amd64.deb

# Works automatically after login!

🚀 What Works Now

  • Auto-starts on login (systemd user service)
  • Desktop notifications (runs in user session with DBus access)
  • Zero manual steps (post-install script handles everything)
  • Reliable monitoring (background process survives reboots)
  • Clear logging (journalctl --user -u ram-monitor)

📦 Distribution Strategy

Primary: .deb package (recommended for best experience)
Secondary: Snap package (available but requires manual start)

🔧 For Existing Snap Users

If you installed via Snap Store:

# Remove snap version
sudo snap remove ram-monitor

# Install .deb version  
wget https://github.com/djordjep/ram-monitor-snap/releases/download/v0.2.0/ram-monitor_0.2.0_amd64.deb
sudo dpkg -i ram-monitor_0.2.0_amd64.deb

📋 Files

  • ram-monitor_0.2.0_amd64.deb - Production Ubuntu/Debian package
  • Complete packaging infrastructure in repository

🎉 Result

The RAM monitor now delivers on its promise: install → works automatically → monitors RAM → sends notifications → zero hassle!


Technical Details:
- Systemd user service replaces problematic snap daemon
- Native desktop integration vs snap confinement limitations
- Standard Linux packaging patterns for maximum compatibility

This release represents a complete pivot from experimental Snap features to proven Linux packaging standards. The app now "just works" as originally intended! 🚀


Assets:
- ram-monitor_0.2.0_amd64.deb - Ubuntu/Debian package
- Source code available in repository

Built with ❤️ (Cursor + Grok code) to solve a real Linux usability issue. No more frozen systems during deep coding sessions!