Managing Surface Memory

If too many Microsoft Surface applications are running at the same time in a user session, the system runs out of physical memory and the Windows 7 operating system starts paging memory. As a result, the system's performance degrades noticeably: animations stop running smoothly, new applications time out in the loading screen while they are starting, touch tracking lags behind, and so on.

How the Memory Manager Works

To help avoid these performance problems, the Surface memory manager monitors how much physical memory is being used and starts to close inactive applications if the system is overloaded. By default, when over 60% of the total physical memory is being used, the memory manager considers the system to be overloaded. (You can change this threshold value through a registry entry. For more information, see the following "Configuring the Memory Manager" section.)

When the system is overloaded, the Surface memory manager first closes the least recently opened application, based on the time when a user last interacted with each application.

When the memory manager closes an application, it first tries to gracefully close the application by asking the application to close itself. If the application does not close during a given time period, the memory manager ends the application. (This time period is the same time period that you can configure through the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Surface\v2.0\Profiles\<Profile_Name>\Shell\ApplicationExitTimeout registry entry. For more information about this registry entry, see Surface Registry Keys. If the process is still running (for example, the application is being debugged), the memory manager tries to close the next least recently opened application.

You can also specify applications that are exempt and that the memory manager should never close (for example, if an application maintains a user state, such as a chess or poker game).

If there is only one application running when the memory manager detects a memory overload, the memory manager does not close the application because that action might close the current user experience. Similarly, if the memory manager reviews the list of exempt applications and the foreground application is the only application that it can close, the memory manager does not close the application to avoid disrupting the current user experience.

Configuring the Memory Manager

There are three registry entries that you can use to configure the memory manager. These entries are located under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Surface\v2.0.


Entry Description Default value


The MemoryManagerExemptApplications entry specifies the list of applications that are exempt from the Microsoft Surface memory manager.

Each application that you list in this entry must be in the form of a DWORD value. The Name field of each entry should match the name of the application that is specified in the application's XML registration file.

Valid values are 1 to exempt an application from closing, or 0 if it is not exempt.

By default, MemoryManagerExemptApplications is empty.

No default value

Profiles\ <Profile_Name> \Shell\MemoryManagerOverloadThreshold

The MemoryManagerOverloadThreshold entry is a DWORD value that specifies the memory threshold percentage when Surface Shell starts to close applications. When the total physical memory that is being used exceeds the percentage specified in MemoryManagerOverloadThreshold, the system is considered overloaded and Surface Shell starts to close applications.

Valid values for range from 0 to 100 decimal. (Because this entry is a percentage, you must type a value by using the decimal base, not the default hexadecimal base.)


Profiles\ <Profile_Name> \Shell\EnableMemoryManager

The EnableMemoryManager entry is a DWORD value that determines whether Surface memory manager is enabled.

Valid values for EnableMemoryManager are 0 (memory manager is disabled) and 1 (memory manager is enabled.)

Developer or default: 0 (disabled)

SurfaceDebug or SurfaceStandard: 1 (enabled)

Memory Manager Event Logs

When the Surface memory manager closes an application, the memory manager creates a new event log entry that indicates that the memory manager closed an application to prevent memory overloading. The event log entry's ID is 112, and it is logged in Event Viewer, under Application and Services Logs\Microsoft\Surface\Shell\Operational as an Informational event. The following example shows an event log entry when the memory manager closed an application called Grand Piano.

Surface Shell closed an application to avoid overloading the system memory.
Application info file: GrandPiano.xml
Application file name: c:\Program Files\Microsoft Surface\GrandPiano\GrandPiano.exe
Process ID: 777

Did you find this information useful? Please send us your suggestions and comments.

© 2011 Microsoft Corporation. All rights reserved.