Topic
[KB1125]Increasing the maximum number of USER and GDI objects that can be created per-process
Applies to:
Windows XP onwards |
||
|
||
Summary:
This article describes how to increase the maximum number of USER and GDI objects that can be created per-process. |
||
|
||
Details:
The system provides two categories of GUI objects: USER and GDI (Graphics Device Interface). USER objects USER objects get their name from the fact that they represent user interface elements like windows, menus, cursors, icons, and accelerator tables (menu keyboard shortcuts). A basic limitation imposed by the Window Manager is that no process can create more than 10000 USER objects. That limitation attempts to prevent a single process from exhausting the resources associated with USER objects, either because it is programmed with algorithms that can create excessive number of objects or because it leaks objects by allocating them and not deleting them when it is through using them. You can easily verify this limit by running the Sysinternals Testlimit utility with the -u switch, which directs Testlimit to create as many USER objects as it can: There is a theoretical limit of 65536 USER objects per session. However, the maximum number of USER objects that can be opened per session is usually lower, since it is affected by available memory. There is also a per-process limit of USER objects. To change this limit, set the following registry value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\USERProcessHandleQuota This value can be set to a number between 200 and 18000, with a default value of 10000. GDI objects GDI objects represent graphical device interface resources like fonts, bitmaps, brushes, pens, and device contexts (drawing surfaces). As it does for USER objects, the Window Manager limits processes to at most 10000 GDI objects, which you can verify with Testlimit using the -g switch: There is a theoretical limit of 65536 GDI objects per session. However, the maximum number of GDI objects that can be opened per session is usually lower, since it is affected by available memory. There is also a per-process limit of GDI handles. To change this limit, set the following registry value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\GDIProcessHandleQuota This value can be set to a number between 256 and 65536, with a default value of 10000. How to set the maximum number of USER and GDI objects that can be created per-process IMPORTANT: This method contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base: 322756 – How to back up and restore the registry in Windows Press WIN + R key to launch the Run command dialog, type regedit, and then press Enter. If you are prompted for an administrator password or for confirmation, type the password or provide confirmation. In the Registry Editor, navigate to the following registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows In the right pane of the Registry Editor, locate the registry values USERProcessHandleQuota and GDIProcessHandleQuota. The range for USERProcessHandleQuota is [200..18000] and the default value is 10000 (Decimal). The range for GDIProcessHandleQuota is [256..65536] and the default value is 10000 (Decimal). Double click the registry value to edit, please make sure select the correct base (Hexadecimal or Decimal) when key in the value. Close the Registry Editor. The system must be restarted for this change to take effect. Use the Testlimit tool to check if changing these settings works. Below picture shows USER objects limit is 18000 and GDI objects limit is 30000. |
||
|
||
|
Created on: 02 Aug 2021 Last update: 04 Sep 2024