How To Fix KERNEL_MODE_HEAP_CORRUPTION Blue Screen
KERNEL_MODE_HEAP_CORRUPTION is a Windows blue screen with the stop code 0x13A.
Microsoft says it means the kernel mode heap manager detected corruption in a heap.
Microsoft’s own page is aimed at programmers, so this guide pairs it with the general repair steps Microsoft gives to everyday users.
Table of Contents
- Quick answer
- What KERNEL_MODE_HEAP_CORRUPTION means
- What the first parameter tells you
- Update drivers first
- Roll back or reinstall a driver
- Use Safe Mode if Windows keeps crashing
- Repair system files and check the drive
- Update firmware and scan for malware
- Read the crash dump if it keeps coming back
- Driver Verifier is an advanced option
- Undo a recent change
- Run hardware and memory tests
- When to contact support
- Sources and related guides
Quick answer
Start with the table, then work down the guide until the blue screen stops.
| Step | Where to do it |
|---|---|
| Update drivers | Settings, then Windows Update, then Device Manager |
| Roll back or reinstall a driver | Device Manager, then the device Properties |
| Repair system files | Elevated Command Prompt: DISM, then sfc /scannow |
| Check the drive | chkdsk /f /r, then restart |
| Undo a recent change | System restore point, uninstall updates or Reset this PC |
What KERNEL_MODE_HEAP_CORRUPTION means
The bug check has the value 0x0000013A.
A heap is a block of memory that the kernel hands out in pieces to drivers and system components.
This stop code appears when the heap manager finds that its own bookkeeping no longer makes sense.
Microsoft’s page has no separate cause section, but its list of corruption types names the likely culprits.
Those include use-after-free errors, buffer overflows and underruns, double frees and a wrong heap handle.
What the first parameter tells you
Parameter 1 holds the type of corruption, and it is the most useful value in a crash dump.
| Value | Microsoft’s description |
|---|---|
| 0x3 | A corrupt entry header was detected |
| 0x4 | Multiple corrupt entry headers were detected |
| 0x6 | Corruption consistent with a buffer overrun |
| 0x7 | Corruption consistent with a buffer underrun |
| 0xB | Features consistent with using a block after freeing it |
| 0xC | The wrong heap was specified for the operation |
| 0xD | Corrupt free list, possibly use-after-free or an overflow of an adjacent block |
| 0x11 | Invalid internal state, possibly a double free or heap corruption |
| 0x13 | The heap API was passed a NULL heap handle |
| 0x15 | A commit request would exceed the current commit limit |
Parameter 2 is the address of the heap that reported the problem, parameter 3 is where the corruption was detected, and parameter 4 is reserved.
Update drivers first
Driver checks come first in Microsoft’s general guidance, and several corruption types in the table above describe code misusing memory.
Microsoft recommends letting Windows Update handle drivers before you install anything by hand.
- Open Start, then Settings, then Windows Update.
- Select Check for updates and install what is offered.
- Right-click Start and open Device Manager.
- Look for devices marked with an exclamation point.
- Right-click the device, select Update driver and choose to search automatically.
If Windows finds nothing, you can download a driver from the device maker and choose Browse my computer for drivers instead.
Roll back or reinstall a driver
If the blue screen started after a driver changed, undo that change.
- In Device Manager, right-click the device and select Properties.
- Open the Driver tab and select Roll Back Driver.
- Pick a reason, confirm and restart if prompted.
To reinstall instead, right-click the device, select Uninstall device, confirm and restart so Windows tries to reinstall it.
Rolling back needs administrator permissions.
Use Safe Mode if Windows keeps crashing
If the PC crashes before you can finish those steps, work from Safe Mode.
Go to Settings, then System, then Recovery, and select Restart now beside Advanced startup.
Then choose Troubleshoot, Advanced options, Startup Settings and Restart.
Press 4 or F4 for Safe Mode, or 5 or F5 for Safe Mode with Networking so you can download drivers.
Microsoft notes you can disable a faulty driver in Device Manager from Safe Mode.
Repair system files and check the drive
Microsoft’s stop error guide also lists a handful of checks that rule out damaged files.
- Open an elevated Command Prompt.
- Run
DISM.exe /Online /Cleanup-image /Restorehealth. - Run
sfc /scannowand leave the window open until it reaches 100%. - Run
chkdsk /f /rand restart if asked, because a system drive is scanned at startup.
Keep about 10% to 15% of the drive free while you do this.
Update firmware and scan for malware
Microsoft’s troubleshooting guide for stop errors recommends installing the latest cumulative updates.
It also recommends updating the BIOS and firmware.
It suggests running Microsoft Safety Scanner or another antivirus scanner that checks the master boot record.
Check your PC maker’s support page for BIOS files, and read its notes before you flash anything.
Read the crash dump if it keeps coming back
Windows can save a dump file after each crash.
| Dump type | Location |
|---|---|
| Small memory dump (256 KB) | %SystemRoot%\Minidump |
| Kernel, complete, automatic and active dumps | %SystemRoot%\MEMORY.DMP |
To collect dumps, search for Advanced system settings, open Settings under Startup and Recovery, and choose Automatic memory dump.
On another PC, install Debugging Tools for Windows, open the dump in WinDbg and run !analyze -v.
Microsoft’s heap page also names the !heap extension for heap usage details.
In the STACK_TEXT section, a module ending in .sys points to the driver involved.
Driver Verifier is an advanced option
Microsoft describes Driver Verifier as a tool that stresses drivers to expose faults.
It advises testing suspicious drivers first and enabling it on groups of 10 to 20 drivers at a time.
It warns the tool uses a lot of CPU, can slow the system badly and can cause extra crashes.
It does not run in Safe Mode, so Safe Mode is how you turn it off if Windows will not reach the desktop.
Undo a recent change
If the crashes began after an update, driver or new app, Microsoft says a restore point or Startup Repair is the best option.
Other options from its recovery page are to uninstall a recent update, Reset this PC with or without keeping files, or reinstall from installation media.
Have your BitLocker recovery key ready, because most recovery options ask for it on an encrypted drive.
Run hardware and memory tests
Microsoft’s stop error guide says to run any relevant hardware and memory tests.
It also says to contact the hardware vendor for diagnostics when you need them.
Remove recently added memory or add-in cards and test again if the crashes began after a hardware change.
If the blue screen disappears, the part you removed is the likely cause and worth replacing or exchanging.
When to contact support
Contact your PC maker or Microsoft if the stop code returns after a clean Windows reinstall.
Give them the stop code, the parameter 1 value from the dump and the driver name from STACK_TEXT.
That information lets support narrow the problem much faster than a general description.
Sources and related guides
Related stop codes on our site include KERNEL_SECURITY_CHECK_FAILURE, MEMORY_MANAGEMENT and BAD_POOL_CALLER.