xf.is Blog   Archives  About

Blacklist bad memory addresses in Windows

2018-06-22

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):

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).

memtest86 bcdedit Memory range from Memory range to Size
0x1BFAE5474 0x1BFAE5 0x1BFAE5000 0x1BFAE5FFF 4 KB
0x116A3FE55 0x116A3F 0x116A3F000 0x116A3FFFF 4 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.

Sysinternals RAMMap

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).