xf.is blog

Blacklist bad memory addresses in Windows

Published (updated: ) in windows.

I recently experienced random MEMORY_MANAGEMENT BSOD on my personal computer. When consulting Microsoft Dev Center for the error code it indicated a issue with the RAM.

The computer is 6 years old and only has 8 GB of RAM (two sticks) I’m not about to spend money to replace the RAM.

I ran memtest86 and got two bad memory spots in two tests (Moving inversions, random pattern):

  • 0x1BFAE5474
  • 0x116A3FE55

Windows is able to blacklist bad memory addresses using the bcdedit tool. However it only blacklists page of memory (4KB) instead of single address. In order to convert from memtest86 single address syntax to bcdedit pages syntax I had to remove the last 3 letters from each memory address (since 0xFFF is 4KB).

memtest86bcdeditMemory range fromMemory range toSize
0x1BFAE54740x1BFAE50x1BFAE50000x1BFAE5FFF4 KB
0x116A3FE550x116A3F0x116A3F0000x116A3FFFF4 KB

Running command promt as administrator I could blacklist the memory addresses:

# Enable memory blacklisting
bcdedit /set {badmemory} badmemoryaccess no
# Specify what addresses to blacklist
bcdedit /set {badmemory} badmemorylist 0x1bfae5 0x116a3f

and reboot.

To verify that the memory addresses are blacklisted use

bcdedit /enum {badmemory}

or use RAMMap from Microsoft.

This solved my MEMORY_MANAGEMENT BSOD and random program crashes.

Caveat

When upgrading from one major Windows versions to another (for example 1709 to 1803) these settings are lost and have to be reapplied.

This is not a permanent fix but should help on older systems or systems where you can’t change the RAM (such as embedded systems).