What's the upper limit on GDI objects for one process in Windows 7?
10K is a hard limit.
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 10,000 GDI objects [...]
Mark Russinovich has a series of articles that go in-depth about the various limits in Windows. You might find these two useful:
- Pushing the Limits of Windows: USER and GDI Objects – Part 1
- Pushing the Limits of Windows: USER and GDI Objects – Part 2
Another good article from Raymond Chen:
- Why is the limit of window handles per process 10,000?
There is a solution that might work. I deal with a misbehaved vendor's app here that allocates tons of GDI objects and this solution allows it to work most of the time...
Do
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems" /v windows
Look for SharedSection=
which should be 3 numbers separated by commas. Increase the middle number by 1024 at a time and see if that solves your problem. You are controlling the amount of "desktop heap" with this variable which has in the past allowed me to get a misbehaving GDI running.
Look at KB184802 for a little more info. Search for SharedSection to find the relevant part of the page.