Jump to content

Windows system GDI object limit problem


Recommended Posts

I have developed a large application using labview, in this project there are more than 3000 labview files! During the process of building the application LabVIEW crashed, later I found out that the reason for the crash of labview is that during the process of building the application the GDI objects of the labview session exceeded 10000, later I changed the system parameters of windows to solve the problem, but if I continue to develop on this project does it end up with labview is not able to build the application, how can I go about solving this problem.

 

GDI Objects - Win32 apps | Microsoft Learn

Link to comment
2 hours ago, MikaelH said:

Change the limit to 65535 instead of 10000 in the Windows Registry
I have a file named: Max GDI Objects.reg
With this content:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows]
"GDIProcessHandleQuota"=dword:0000ffff

Thank you very much for your reply, I thought no one else had had this problem.

Link to comment
6 hours ago, hooovahh said:

I have seen others on the forums state that this can be an issue.  What are the symptoms of hitting this limit?  Should I just set this value on all development machines just in case?

When I had a customer run into this problem they would have a DAbort "Couldn't create 24 pen" in drawmgr.cpp and before that were a ton of "GetDC failed in ISetGPort" DWarns coming from image.cpp (like 15+ DWarns in the 2 seconds before the crash, some within milliseconds of each other).

  • Like 1
Link to comment
18 hours ago, hooovahh said:

I have seen others on the forums state that this can be an issue.  What are the symptoms of hitting this limit?  Should I just set this value on all development machines just in case?

If this limit is reached, the labview crashes.

1182728697_2023-07-26134934.png.e6982e73bdc9d75109971b247095d1c4.png

Link to comment

There is a KB article about this: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P7OGSA0&l=en-GB

We also had this problem when building a large application. You could see the GDI object counter hit the limit in task manager and soon after LabVIEW would crash.

After upgrading to LabVIEW 2020 SP1 it went away, though I have not explicitly heard that this problem was fixed.

  • Like 2
Link to comment
  • 3 weeks later...

There is no simple fix to that. In order to draw anything on a Windows GUI you do need GDI objects. Every Window is one, every subwindow, every icon or bimap is one, every line or arc could be one, every text can be even two or three. You can open them, draw them to the device context and close them afterwards but opening/creating them costs time so if you foresee to use them again it’s a pretty smart idea to keep them around instead of spending most of your program execution time in creating and destroying them continuously.

The only thing LabVIEW programmers can do is to try to combine more operations into a single object and/or finding the objects that are rarely needed and pay the runtime performance penalty to recreate them each time instead of keeping them around. Also I’m pretty sure that 3D controls with alpha shading may look cool to some people but tend to increase the GDI object count substantially. Classic and Dialog controls are a lot easier to draw!

Edited by Rolf Kalbermatter
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.