RAM Test and Error Detection with Windows Memory Diagnostic Tool

RAM (Random Access Memory) is the temporary memory area that holds the code and data the processor is working on at that moment. The operating system kernel, the drivers and all running applications share this area. For this reason, when a single cell in RAM returns a wrong value, the symptoms differ widely depending on which data the error affects. The same fault can close an application one day, corrupt a file another day and cause a Blue Screen of Death (BSOD) error the day after.

Because the symptoms are so scattered, RAM errors are often mistaken for driver, disk or software problems. A memory test is run to remove this uncertainty. The test writes known values to the memory cells, reads the same cells back and compares the value read with the value written. Windows provides a built-in tool for this task, called Windows Memory Diagnostic Tool. The sections below first explain how RAM errors occur and how test algorithms detect them, and then cover how the tool works, how to use it and how to read its results.

This article is not tied to a specific Windows version. Windows Memory Diagnostic Tool was previously a separate download and became part of the operating system with Windows Vista and Windows Server 2008. The steps described here are the same in later versions that have a desktop interface.

How Do RAM Errors Occur?

A DRAM cell consists of 1 capacitor and 1 transistor. The bit is represented by the charge state of the capacitor. Which charge state counts as 1 and which as 0 depends on the design of the cell. In a true-cell structure, a charged capacitor represents the value 1, and in a complement-cell structure it represents the value 0. Because the capacitor loses its charge over time, the memory controller rewrites the cells at intervals in the order of milliseconds. This operation is called Refresh.

When a bit changes value unexpectedly, this is called a Bit Flip. However, a read value that differs from the written value does not always show that the bit in the target cell changed. With a fault on the address decoding side, the content of another cell may have been read. This is why test algorithms target more than 1 fault model separately.

Memory errors are divided into 2 groups according to their persistence. A Hard Error is caused by a physical defect and occurs repeatedly in the same cell. A Soft Error occurs momentarily, without permanent damage to the cell, because of cosmic rays, electrical noise or voltage and timing values that operate at their limits. Memory tests detect Hard Errors reliably. Soft Errors are not seen unless they repeat during the test.

Test algorithms target the functional fault models defined on the hardware side. The main models are listed in the table below.

Fault Model Behaviour
Stuck-at Fault The cell always returns 0 or always returns 1, whatever is written to it.
Transition Fault The cell can hold a value but cannot make the transition from 0 to 1 or from 1 to 0.
Coupling Fault The value of a cell, or an operation performed on that cell, affects the value or the behaviour of another cell.
Address Decoder Fault An address reaches no cell, selects several cells together, or several addresses lead to the same cell.
Data Retention Fault The cell loses its charge before the Refresh interval ends, and its value changes by itself.

Memory Test Algorithms

Writing a single pattern and reading it back does not reveal most of the fault models above. For example, a test that writes 0 to all cells reports a cell stuck at 0 as healthy. For this reason, memory tests run several algorithms one after another, each targeting a different fault model.

✅ Pattern Testing: The memory is filled with specific patterns and read back. 0x00000000 and 0xFFFFFFFF show that every bit can hold both extreme values. Checkerboard patterns such as 0xAAAAAAAA and 0x55555555 write opposite values to neighbouring bits and can reveal some interactions between cells. Writing a pattern and then its inverse tests only 1 transition direction for each bit. To test both directions, the test returns to the starting pattern and reads the result of each transition separately.

✅ Address Line Testing: A value unique to each address is written to that address, and all addresses are read back. If 2 addresses lead to the same cell, the second write operation overwrites the first, and the difference appears during the read. This test does not check the cells themselves. It checks the address decoding circuit and the address lines.

✅ Walking Bit (Walking 1s / Walking 0s): A single 1 bit inside a word that is otherwise all 0 is written and read, and it is shifted by 1 position at each step. Walking 0s is the opposite. The aim is to see whether a specific data line is short-circuited to neighbouring lines and whether each bit position works independently of the others.

✅ March Tests: The memory is scanned in steps called March elements. Each element is a sequence of read and write operations applied to a single cell before the test moves to the next cell, and it goes through the addresses in ascending or descending order. The direction of the elements and the operations they contain vary by algorithm. There are also initial steps that only write and verification steps that only read. MATS+ is a simple member of this family.

✅ Stride and Random Pattern Tests: Stride tests access the memory at fixed step intervals, and random pattern tests write unpredictable data sequences. Errors that regular patterns do not trigger, and that depend on specific access orders or data combinations, become visible with these tests.

✅ Data Retention Testing: After a value is written to the cell, the test waits for a set period and reads the value again. Weak cells that lose their charge before the Refresh interval appear during this wait.

The common limit of these algorithms is that the error must occur during the test. Intermittent errors that are sensitive to temperature, that are triggered under a specific load or that depend on voltage fluctuation may not be seen in a single short test. A clean result shows that no error was detected in the regions the test could reach, with the patterns it applied and under the conditions at that time. It does not prove that the memory is free of defects.

Hardware-Side Error Checking with Parity and ECC

Test algorithms run on the software side. Parity and ECC are mechanisms that handle memory errors at the hardware level at run time, and they are not a test method.

Parity adds a single check bit to each data group. This bit is calculated when the data is written, recalculated during the read and compared with the stored value. A change in a single bit is noticed in this way, but the error cannot be corrected because it is not known which bit changed. If 2 bits change in the same group, Parity cannot see it.

ECC (Error Correcting Code) memory stores check bits together with the data. In the common x72 DDR3 and DDR4 ECC DIMMs, 8 check bits accompany every 64 data bits. DDR5 ECC DIMMs come in x72 (EC4) and x80 (EC8) layouts. In designs that use SECDED (Single Error Correction, Double Error Detection), a single-bit error within the same code word is corrected at read time, and a double-bit error is detected. For ECC to work, the processor and the motherboard must also support ECC, in addition to the memory module.

On systems that use ECC, the following detail must be taken into account when a memory test is interpreted. Because single-bit errors are corrected by the hardware, correct data reaches the test software, and the test may not see the error. Corrected ECC errors that the platform reports to WHEA (Windows Hardware Error Architecture) are processed by Windows. When the threshold defined for the error source is exceeded, Windows writes a record to the System log with the source WHEA-Logger. A separate record must not be expected for every ECC correction. When memory health is assessed on a system with ECC, these records must be checked together with the test result.

How Does Windows Memory Diagnostic Tool Work?

In a running Windows installation, physical memory is used by the kernel, the drivers and the applications. In this state, an application cannot safely write a test pattern over all of the memory that is in use. For this reason, Windows Memory Diagnostic Tool runs before Windows loads.

The tool consists of 2 parts. mdsched.exe, which is run from within Windows, does not test anything. It only schedules the test for the next startup. When the computer restarts, Windows Boot Manager starts the memory diagnostics environment instead of the operating system. The tests run on the memory map that the firmware presents to this environment. There may be regions reserved for the firmware, and these regions may be outside the scope of the test. When the test finishes, the computer restarts by itself and Windows starts normally.

Microsoft states that, outside Windows, the tool can also be started from Windows Recovery Environment or from installation media. The entry point varies by Windows version and by the media used.

Test Modes

👉 The tool offers 3 test modes. Each mode includes the tests of the previous one and adds new ones. The test names are listed with these abbreviations on the tool's own options screen.

Mode Tests Included Use
Basic MATS+, INVC, SCHCKR (cache on) This is the shortest mode. It reveals obvious Hard Errors quickly and may miss less obvious errors.
Standard The Basic tests plus LRAND, Stride6 (cache on), CHCKR3, WMATS+, WINVC This is the default mode. It balances duration and coverage, and it is sufficient for most faults.
Extended The Standard tests plus MATS+ (cache off), Stride38, WSCHCKR, WStride-6, CHCKR4, WCHCKR3, ERAND, Stride6 (cache off), CHCKR8 This is the most comprehensive mode. It can take hours, depending on the amount of memory. It is used when Standard mode gives a clean result but the symptoms continue.

The abbreviations correspond to the algorithm families described in the earlier section. MATS+ is a March test. INVC looks for inverse coupling faults with 0 and 1 fill operations. SCHCKR uses a simple Checkerboard pattern. CHCKR3, CHCKR4 and CHCKR8 are the 3x3, 4x4 and 8x8 extended Checkerboard patterns respectively. LRAND and ERAND apply random data to the memory. Stride6 and Stride38 create a Checkerboard-like pattern with the stated step interval. Tests whose names start with W are versions of the same test that run with patterns adapted to the memory in the system.

Cache and Pass Count Settings

Pressing F1 while the test is running opens the options screen. This screen has 3 settings. TAB moves between the fields, F10 applies the settings and restarts the test, and ESC exits without making changes.

Setting Options Effect
Test Mix Basic, Standard, Extended Determines the test group to run.
Cache Default, On, Off Determines whether the processor cache is used during the tests. When Default is selected, each test runs with its own default setting.
Pass Count The default value is 2 Determines how many times the selected test group is repeated.

The Cache setting directly affects test coverage. When the cache is on, the processor can read the data it has just written from its own cache without going to RAM. In this case the comparison succeeds, but the RAM cell is not actually tested. When the cache is turned off, the processor cache masks fewer of the test accesses. Because other buffers on the memory path can continue to operate, there is no guarantee that every access reaches the module with no buffer in between. The test becomes noticeably slower, but the errors that the cache hides become visible. This is why Extended mode runs some of its tests with the cache off.

Pass Count is increased for intermittent errors. The memory is scanned again on each pass. Errors that are sensitive to temperature or to duration may not appear on the first pass and may appear on later passes. As the value increases, the total duration also increases.

Using Windows Memory Diagnostic Tool

The steps below apply to Windows Client and Windows Server (Desktop Experience) installations that have a desktop interface. The default installation of Server Core has no desktop interface and no local Event Viewer. On Windows Server 2019 and later, eventvwr.msc can be used locally if the Server Core App Compatibility Feature on Demand is installed. Before you start the test, make sure that the conditions below are met.

Check Expected State
Permissions Scheduling the test requires administrator rights. In a standard user session, elevation is possible with the credentials of an administrator account if the UAC policy allows it.
Open work All documents are saved and the applications are closed.
Duration It has been taken into account that the computer cannot be used during the test. The duration ranges from minutes to hours, depending on the amount of memory and the selected mode.
Power On laptops, the power adapter is connected.

1. Press the Windows+R keys together.

2. The Run dialog box opens. Type the mdsched.exe command in the box and press Enter.

Running the mdsched.exe command in the Run dialog box

3. The Check your computer for memory problems window opens. This window has 2 options. Restart now and check for problems (recommended) restarts the computer immediately and starts the test. Check for problems the next time I start my computer schedules the test for the next startup and lets you continue working.

4. Click the Restart now and check for problems (recommended) option.

Windows Memory Diagnostic Tool restart options

The Restart now option restarts the computer without asking for confirmation. Unsaved work is lost.

5. When the computer restarts, the memory test starts by itself. By default, the tool runs 2 passes in Standard mode. The screen shows the current pass, the overall progress percentage and the Status line. To change the mode, the Cache setting or the number of passes, press F1 on this screen.

Windows Memory Diagnostic Tool memory test screen

Checkpoint
While the test is running, the Status line shows the text No problems have been detected yet. When an error is found, this line changes, and the test continues to run until it is complete.

When the test finishes, the computer restarts and Windows starts. The ESC key can be pressed to stop the test before it finishes. In this case, a cancellation record is created instead of a record with a clean or faulty result.

Reading the Test Results

After Windows starts and you sign in, a notification that summarises the test result appears in the notification area. This notification stays on the screen for a short time and may not always appear. The permanent record is kept in Event Viewer.

To see the result, open Event Viewer with eventvwr.msc and go to Windows Logs > System. Click the Filter Current Log option in the right pane, select the MemoryDiagnostics-Results source in the Event sources list and confirm. The records below are defined under this source.

Event ID Meaning
1101, 1201 The test completed and no errors were detected in the memory.
1102, 1202 The test completed and a hardware problem was detected in the memory.
1103 The test was cancelled while it was running.
1104 The memory tests could not be completed.

The same records can also be retrieved with PowerShell. The command below is run in a PowerShell session opened as administrator and lists the latest records of this source.


Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='Microsoft-Windows-MemoryDiagnostics-Results'} -MaxEvents 4 | Format-List TimeCreated, Id, LevelDisplayName, Message

The Id field in the output is matched against the table above. The TimeCreated and Message fields are used to confirm that the record belongs to the most recently run test. If the command returns the No events were found error, no record of this source was found in the current System log. The test may never have completed, the log may have been cleared or the old records may have been overwritten. If a current result is needed, the test must be scheduled again.

What to Do When an Error Is Detected

An error found by the test does not prove by itself that the memory module is faulty. The same result can also be caused by the memory slot, by a module that is not fully seated in the slot, by an incompatibility between the module and the motherboard or by running the memory above its supported limits. The source of the error must be narrowed down before a module is replaced.

Reset the memory settings to default. If a memory profile such as XMP, DOCP or EXPO is enabled in the BIOS/UEFI, or if the frequency, timing and voltage values were changed manually, turn these settings off and repeat the test. If the error disappears, the problem occurs under the selected profile.

Test the modules individually. If more than 1 module is installed, leave only 1 in place, run the test and repeat this for each module. Make the comparison in the slot that the motherboard manufacturer recommends for a single module. If the error comes with a specific module, that module is the suspect.

Change the slot. Install the module that gives the error in another slot and repeat the test. If the error follows the module, the module is the suspect. If the error continues in the same slot with different modules that are known to be good, the slot or the related memory channel is the suspect. Before you decide to replace a part, also check whether the module is on the motherboard's compatibility list, and take the memory controller on the processor side into account.

Before you touch the modules, shut down the computer and disconnect the external power. On devices with an internal battery, follow the power disconnection step in the service manual of the model (for example, disconnecting the battery cable).

If the test is clean but the symptoms continue, this result does not clear the memory completely. The error may be intermittent, the applied patterns may not have triggered it, or it may not have reached the test because ECC corrected it. In this case, the test must be repeated in Extended mode and with a higher Pass Count value. If an independent verification is needed, a long test can be run with a bootable tool such as MemTest86. Other components such as the drivers, the disk and the power supply are also among the possible causes and must be assessed separately.

In this article, I explained how RAM errors occur, which fault models the memory test algorithms target and where Parity and ECC fit in this picture. I then covered how Windows Memory Diagnostic Tool works, its test modes, the Cache and Pass Count settings, how the tool is started with mdsched.exe, how the results are read through Event Viewer and PowerShell and how the source is narrowed down when an error is detected.

I hope you find it useful...

No comments on this article yet. Be the first to comment!

750 characters available.
Security code
Comments are published once approved.
Your email is only used to let you know when your comment is approved. It is never published.