ERROR_LOCKED 0x000000D4: Fix memory segment locked on Windows
The ERROR_LOCKED error means a memory segment is locked by a process and Windows can't reallocate it. Here's how to fix it, from a quick reboot to debugging with WinDbg.
What is ERROR_LOCKED (0x000000D4)?
If you're seeing error code 0x000000D4 with the message "The segment is locked and cannot be reallocated," you've hit a Windows memory management snag. This typically shows up as a Blue Screen of Death (BSOD) or a system freeze when you're running memory-intensive apps—think virtual machines, video editing software like Adobe Premiere, or heavy database queries. The core problem: a kernel-mode process has locked a memory segment (a "locked page"), and when Windows tries to move it around during paging or compaction, it can't. The result? Crash.
I know BSODs are infuriating—especially when you're in the middle of something important. Let's get this fixed. Start with quick fix, then work your way down. Stop when the error stops.
Quick fix (30 seconds): Reboot and clear locked pages
This sounds dumb, but it works more often than you'd think. A simple reboot releases all locked memory segments. If the error was triggered by a one-off driver glitch or a temporary allocation conflict, restarting clears the slate.
- Save your work.
- Restart Windows normally (Start > Power > Restart).
- If the error doesn't come back, you're done. If it reappears after a few hours or days, move to the moderate fix.
Why this works: When Windows boots, it reinitializes memory pools. Any lock held by a misbehaving driver or app is dropped. This won't fix a persistent driver problem, but for transient errors—especially after a recent software install—it's your first and easiest shot.
Moderate fix (5 minutes): Check for driver conflicts and update key drivers
If rebooting didn't cut it, a driver is likely holding a memory segment hostage. The usual suspects: graphics drivers (NVIDIA, AMD), storage drivers (especially older SATA or NVMe drivers), or virtualization drivers (VMware, Hyper-V).
- Press Win + X and select Device Manager.
- Expand Display adapters. Right-click your GPU and select Update driver > Search automatically for drivers. If Windows finds nothing, go to the GPU manufacturer's site (NVIDIA, AMD, Intel) and download the latest driver manually. For NVIDIA, use the Studio driver if you're not gaming—it's more stable.
- Expand Storage controllers. Update your storage drivers (usually "Standard NVM Express Controller" or "Intel Chipset SATA Controller"). Download the latest from your motherboard or laptop vendor's site—don't rely solely on Windows Update.
- Run chkdsk C: /f in an admin Command Prompt (right-click Start > Command Prompt (Admin) or Terminal (Admin)). This checks for file system corruption that can trigger memory allocation failures. Reboot when prompted.
After these steps, use your system normally for a few hours. If the error recurs, the problem is deeper—likely a corrupted memory pool from a bad driver, hardware failure, or kernel bug.
Advanced fix (15+ minutes): Diagnose with WinDbg and check memory
This is where we get surgical. The 0x000000D4 bug check (BSOD) usually points to a pool corruption or a driver that locked pages without releasing them. You'll need a crash dump to pinpoint the culprit.
Step 1: Enable crash dumps
- Right-click This PC > Properties > Advanced system settings.
- Under Startup and Recovery, click Settings.
- Set Write debugging information to Automatic memory dump. Make sure %SystemRoot%\MEMORY.DMP is the path. Click OK.
- Reboot to make it stick.
Step 2: Analyze the dump with WinDbg
- Download WinDbg from the Microsoft Store or the Windows SDK.
- Open WinDbg as admin. Go to File > Open Crash Dump and browse to C:\Windows\MEMORY.DMP (or Minidump directory for smaller dumps).
- At the command prompt, type:
!analyze -v - Look for the line MODULE_NAME or IMAGE_NAME. That's the driver causing the lock. Common culprits:
ntfs.sys(file system driver),dxgkrnl.sys(DirectX graphics kernel),storahci.sys(storage driver), or third-party drivers likevmkbd.sys(VMware). - If you see a specific driver name (e.g.,
nvlddmkm.sysfor NVIDIA), update or roll back that driver. If it's a system file likentfs.sys, the issue might be hardware-related.
Step 3: Run memory diagnostics
Sometimes locked pages are a symptom of failing RAM. If the dump analysis shows ntoskrnl.exe or memory_corruption flags, run the built-in tool:
- Press Win + R, type
mdsched.exe, hit Enter. - Choose Restart now and check for problems. This runs a memory test during boot that takes about 30-45 minutes. If errors show up, replace the faulty RAM stick.
Step 4: If nothing else works—disable memory paging or update firmware
This is a last resort. Disabling the paging file (System Properties > Advanced > Performance > Advanced > Virtual memory) can sometimes avoid the reallocation conflict, but it'll eat your physical RAM and may cause other crashes. I only recommend this if you're waiting for a hardware replacement.
Also check your motherboard or laptop vendor for BIOS/UEFI updates. I've seen firmware updates fix memory management bugs in Lenovo ThinkPads and Dell XPS systems that triggered this exact error under load.
When to call it
If you've done the advanced steps and the error still pops up—especially if the dump points to ntfs.sys or memory_corruption without a clear driver name—your RAM or storage drive might be failing. Replace the RAM first (it's cheaper), then the drive. Don't keep chasing software fixes for a hardware problem.
Was this solution helpful?