Windows 7 Fault Tolerant Heap Prevents Crashing

The Bottom Line
Microsoft has been busy, and they’ve made some smart decisions programatically for Windows 7. The Fault Tolerant heap will help keep applications from crashing once Windows 7 recognizes a pattern, and applies a resolution. Procedures that may have crashed in the past, are less likely to crash in the future. For the normal user, should this be disabled? Absolutely not.

The Details
There’s a new feature in Windows 7 called Fault Tolerant Heap that changes the way an application handles memory if it sees an app is crashing. Consequently, something that caused a crash may not crash again after FTH has been enabled. So in order to reproduce an issue you need to purge the FTH history. Below you will find a command to do this.

If you often run a testing environment, as I do, it would be wise to consider running this command after a crash on Windows 7, otherwise FTH will mask issues.

I’ve also included some info below that explains what FTH does when it is enabled.

Description
The Fault Tolerant Heap (FTH) is a subsystem of Windows 7 responsible for monitoring application crashes and autonomously applying mitigations to prevent future crashes on a per application basis. For the vast majority of users, FTH will function with no need for intervention or change on their part. However, in some cases, application developers and software testers may need to override the default behavior of this system.

Viewing Fault Tolerant Heap activity
Fault Tolerant Heap logs information when the service starts, stops, or starts mitigating problems for a new application. To view this information, follow these steps:

1. Click on the start menu
2. Right-click Computer and choose Manage
3. Click Event Viewer > Applications and Services Logs > Microsoft > Windows > Fault-Tolerant-Heap
4. View FTH Events

The service stop and start events contain no additional data. The FTH Enabled event contains the Process ID (PID), the process image name, and the process instance start time.

Disabling Fault Tolerant Heap
CAUTION: Serious problems may occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems may require you to reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To disable Fault Tolerant Heap entirely on a system, set the REG_DWORD value HKLM\Software\Microsoft\FTH\Enabled to 0. After changing this value, restart the system. FTH will no longer activate for new applications.

Resetting the list of applications tracked by FTH
Fault Tolerant heap is self-managing and will autonomously stop applying in the case that mitigations are not effective for a given application. However, if you need to reset the list of applications for which FTH is mitigating problems (for example, if you are testing an application and need to reproduce a crash that FTH is mitigating), you can run the following command from an elevated command prompt:

Rundll32.exe fthsvc.dll,FthSysprepSpecialize

CAUTION: Running this command will clear all FTH applications, so applications that are currently functioning properly may begin to crash again after running this command.

Leaving FTH enabled does 4 things:

1. Zero out allocated memory. This protects against some ununitialized memory errors.
2. They add 8 bytes of padding to the end of the allocation plus 24 bytes for an FTH data structure to each allocated block. This helps fix buffer overruns.
3. They delay frees. When you call free on a block, they don’t actually free it. It goes into a circular list. Once the list holds 4MB of blocks, they start freeing the oldest blocks in the list so that the list does not grow bigger than 4MB. This helps fix dangling pointers and double frees.
4. They do not free during application shutdown. Calls to free are ignored during shutdown.

After enabling FTH Windows 7 continues to monitor the application. If FTH is not reducing the crash frequency, FTH is turned off for that application.

The memory cost of FTH obviously depends on the type of allocations an application makes. FTH will have a bigger impact on an application with lots of small allocations. There is a performance cost as well. Some benchmarks tests Microsoft did on IE showed about a 10% performance hit on page load.

Windows 7, 64-bit, 9Gb RAM
It stands to reason, if you’re looking at upgrading systems, go with Windows 7, 64-bit, 9Gb RAM (because newer systems have tri-channel addressing; RAM is best in blocks of 3Gb – 3,6,9,12Gb, etc.).

The release of Intel’s new Nehalem-based Core i7 CPU has brought the demand for tri-channel memory to the desktop for the first time.

What is tri-channel memory?
Tri-channel memory overcomes the bandwidth limitations of individual memory modules by combining the bandwidth of three sticks at a time, and overcoming DDR2 limitations.

If you buy a new 64-bit Windows 7 system with 8Gb RAM, you’ve made your first mistake (you should have requested 9Gb). By the way, Windows 7 System Maximums are as follows:

Starter: 8GB
Home Basic: 8GB
Home Premium: 16GB
Professional: 192GB
Enterprise: 192GB
Ultimate: 192GB

©2010 Paving the Way. All Rights Reserved.

.

Go to Source