Linux: How do I find out causes for memory faults?

Memory faults can occur due to various causes.

You can use memtester command which stress test to find memory subsystem faults. memtester command is an effective userspace tester for stress-testing the memory subsystem. It is very effective at finding intermittent and non-deterministic faults under Linux.

You can run memtester as follows:


=> MEMORY: The amount of memory to allocate and test, in megabytes
=> ITERATIONS: Number of loops to iterate through. Default is infinite

memtester’s exit code is 0 when everything works properly. Otherwise, it is the logical OR of the following values:

  • x01: Error allocating or locking memory, or invocation error
  • x02: Error during stuck address test
  • x04: Error during one of the other tests

$ memtest 5 1Output:

memtester version 4.0.5 (32-bit)
Copyright (C) 2005 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffff000
want 5MB (5242880 bytes)
got  5MB (5242880 bytes), trying mlock ...locked.
Loop 1/1:
Stuck Address       : ok
Random Value        : ok
Compare XOR         : ok
Compare SUB         : ok
Compare MUL         : ok
Compare DIV         : ok
Compare OR          : ok
Compare AND         : ok
Sequential Increment: ok
Solid Bits          : ok
Block Sequential    : ok
Checkerboard        : ok
Bit Spread          : ok
Bit Flip            : ok
Walking Ones        : ok
Walking Zeroes      : ok


Display memtester’s exit code with following command (it is 0 when everything works properly):
$ echo $?


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 8 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
8 comments… add one
  • Jon Nguyen Mar 23, 2009 @ 4:55

    What is difference of memtester and memtest86 in term of testing memory module?


  • salseeg Nov 1, 2009 @ 13:54

    memtest86 is memory testing OS , it loads as separate one, using bootloader.
    memtester is ser space ie you do not need to reboot your PC to test memeory, but it cannot test all your memory, since some part used by your OS

    • lakshmi May 27, 2015 @ 11:28

      If I want to test the full memory/all memory is that possible? If yes can you tell me how to do that.


  • Unihost Brasil - Webhosting Nov 16, 2010 @ 9:36

    Here’s the link to download the MEMTEST utility from the official developer site:

    Alex M. – Tech Support – Unihost Brasil

  • Radek Feb 2, 2011 @ 20:04

    The command should read:

    memtester 5 1

  • Brian Lockwood Apr 12, 2011 @ 15:14

    Is memtester a distructive test routine? Meaning all contents in that memory space will be lost once memteser is run.



  • Peter Nov 21, 2011 @ 22:44

    Thank you very much for those commands. I’ve been looking at Memtester for a little while trying to figure out how to use it. The manual is always a little intimidating for novices; and your commands ran perfectly.

    I’m now testing a gig on an 8 gig system with 5 passes using:

    memtester 1000 5

    It looks like it is going to take a while but I’d much rather test in user space than have to boot into an iso and sit it out.

    Thanks again.

  • Ted Feb 12, 2013 @ 19:23

    Say my system has 8G — two 4G modules — and say there’s a physical defect in one byte of one of those modules. What’s the chance memtester will detect that defect if I run it as “memtester 1000 5”? As “memtester 2000 5”? Etc…

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum