I'm trying to track down an issue in our MFC code that looks like a resource limitation issue. Memory and CPU look fine. According to the processes tab on the Task manager our GDI objects look in line with other applications, but our USER objects appear to be a factor of 10 greater then other applications.
What is a "USER object" and what are the limits?
A user object is a security principal, which means that it would have a security identifier (SID) apart from a global unique identifier (GUID). A user object in AD has attributes that contain information such as canonical name.
An object is a data structure that represents a system resource, such as a file, thread, or graphic image. Your application can't directly access object data, nor the system resource that an object represents.
Windows has more than 25 types of objects. A few of the types are: Files. Devices.
To create a new user objectOpen the New dialog box. On PB Object tab page, select the kind of user object you want to create. The five user object choices display at the top of the tab page: Click OK.
Here is a "classic" MSDN article: Give Me a Handle, and I'll Show You an Object
Last time I was tracking down Windows object leaks (which i suspect you have) Process Explorer was handy (handley?). The lower-pane could show some allocated system objects, plus it could do the simple USER, GDI, etc object counting.
The desktop heap, which is a pool of memory where the real "stuff" the handle represents lives (at least some handles, not kernel handles at least). It's sometimes not so much how many handles you have allocated but how much memory each object under that handle is using. You can debug the heap this way. It is a pain to install.
Read all about it here:
Object Categories
The system provides three categories of objects: user, graphics device interface (GDI), and kernel. The system uses user objects to support window management, GDI objects to support graphics, and kernel objects to support memory management, process execution, and interprocess communications (IPC). For information about creating and using a specific object, refer to the associated overview.
and here:
User Objects
User interface objects support only one handle per object. Processes cannot inherit or duplicate handles to user objects. Processes in one session cannot reference a user handle in another session.
There is a theoretical limit of 65,536 user handles per session. However, the maximum number of user handles that can be opened per session is usually lower, since it is affected by available memory. There is also a default per-process limit of user handles. 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 18,000.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With