Have you ever experienced random system crashes, mysterious application errors, or corrupted files? Sometimes, the culprit isn't a software bug—it's faulty memory. The memtester utility, originally created by Charles Cazabon and updated by Jason Wee, is a powerful yet simple tool designed to help you diagnose exactly this problem.
What is memtester?
At its core, memtester is a utility for testing your computer's memory subsystem to determine if it's faulty. It's not a replacement for comprehensive hardware diagnostics, but it's an incredibly useful first line of defense when you suspect memory issues.
What makes memtester special? Unlike many memory testing tools that require you to boot from an external medium (like Memtest86+), memtester runs directly from your existing operating system. This makes it perfect for quick tests on production systems, embedded devices, or any situation where rebooting isn't practical.
Key Features
Multiple Test Patterns
The software runs a series of eight different tests that catch various types of memory errors:
Stuck bits (bits permanently high or low)
Data sensitivity issues
Addressing problems
More subtle errors that only appear under specific patterns
Cross-Platform Support
memtester is incredibly portable, with successful builds reported on:
Various Linux distributions (Debian, RedHat, Ubuntu, etc.)
FreeBSD, NetBSD
macOS (OS X)
HP-UX on PA-RISC and Itanium
Tru64 Unix on Alpha
Physical Address Testing
For advanced users, memtester supports testing specific physical memory addresses. This can be useful for checking memory-mapped I/O devices or testing specific RAM banks.
Installing and Using memtester
Installation
Installation couldn't be simpler—there's no complex configure script to run:
# Clone the repository git clone https://github.com/jasonwee/memtester.git cd memtester # Build it make # Install it (optional, to /usr/local/) sudo make install
Basic Usage
The basic command syntax is straightforward:
sudo memtester <memory-amount> [runs]
For example, to test 256 megabytes of memory:
sudo memtester 256MIf you want to run the test only once (the default is unlimited):
sudo memtester 256M 1
Important Notes on Usage
Run as Root:
memtesterneeds root privileges to lock memory pages, preventing them from being swapped out. Without this, testing becomes slow and inaccurate.Memory Amount: You can specify memory in bytes (B), kilobytes (K), megabytes (M), or gigabytes (G). For example:
256M,1G,1024K.Memory is Overwritten: The memory you're testing will be overwritten during testing. Don't point it at memory containing critical system data or running applications!
When Should You Use memtester?
Here are some common scenarios where memtester proves invaluable:
After hardware upgrades: Just added new RAM? Test it before trusting it with your data.
System instability: If you're experiencing random crashes, freezes, or corruption, memory issues should be on your suspect list.
Embedded systems: For devices without external boot media,
memtestercan be cross-compiled and run directly.Overclocking: Testing memory stability after overclocking your system.
Advanced Use Cases
Testing Specific Memory Regions
If you have hardware that exposes memory via /dev/mem or a custom device file:
# Test memory at physical address 0x0C0000 (64KB region) sudo memtester -p 0x0c0000 64k
Custom Device Files
# Test device memory via a custom device file sudo memtester -p 0 -d /dev/foodev 64k
The jasonwee Repository
The GitHub repository maintained by jasonwee serves as a convenient mirror of the original memtester source, with the latest version (4.7.1 as of December 2024). It includes:
The complete source code
Build scripts
Documentation files
Licensing information (GPL v2)
The maintainer builds it for work-related purposes, making it easy to access the latest stable version.
Limitations and Alternatives
While memtester is incredibly useful, it's important to understand its limitations:
Not as comprehensive: For thorough testing (especially finding intermittent errors), you might want to use Memtest86+ or similar bootable tools.
Requires free memory: You can only test memory that's not in use by the system.
Performance impact: The tests can be resource-intensive and may affect system performance.
Final Thoughts
memtester is a gem in the sysadmin's toolkit. Its simplicity, portability, and ability to run from a live system make it an essential utility for diagnosing memory problems quickly. Whether you're a system administrator, developer, or enthusiast, having this tool in your arsenal can save you countless hours of debugging mysterious issues.
The jasonwee GitHub repository ensures this valuable tool remains easily accessible and up-to-date. So next time your system acts up, give memtester a run—it might just identify the problem faster than you'd expect!