xiongxinwei Posted July 26, 2023 Report Share Posted July 26, 2023 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 Quote Link to comment
Popular Post MikaelH Posted July 26, 2023 Popular Post Report Share Posted July 26, 2023 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 3 Quote Link to comment
xiongxinwei Posted July 26, 2023 Author Report Share Posted July 26, 2023 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. Quote Link to comment
hooovahh Posted July 27, 2023 Report Share Posted July 27, 2023 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? 1 Quote Link to comment
hooovahh Posted July 27, 2023 Report Share Posted July 27, 2023 Okay it looks like you'll get an Out of Memory error on building. https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019No1SAE&l=en-US 2 Quote Link to comment
jacobson Posted July 27, 2023 Report Share Posted July 27, 2023 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). 1 Quote Link to comment
xiongxinwei Posted July 28, 2023 Author Report Share Posted July 28, 2023 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. Quote Link to comment
cordm Posted July 28, 2023 Report Share Posted July 28, 2023 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. 2 Quote Link to comment
Rolf Kalbermatter Posted August 13, 2023 Report Share Posted August 13, 2023 (edited) 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 August 14, 2023 by Rolf Kalbermatter Quote Link to comment
VDB Posted August 14, 2023 Report Share Posted August 14, 2023 (edited) Maybe this might help: https://stackoverflow.com/questions/38612364/how-to-increase-the-maximum-amount-of-gdi-object-for-windows-10 Or switching to LabVIEW NXG 🤣, since it is WPF based, which does not use GDI but DirectX directly... Edited August 14, 2023 by VDB 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.