Plex 2E

 View Only

Expand all | Collapse all

Error: "Your system is unable to allocate any more resource handles and 2 GUI controls could not be created."

  • 1.  Error: "Your system is unable to allocate any more resource handles and 2 GUI controls could not be created."

    Posted Apr 28, 2015 01:45 AM

    I have a WinC function with Grid. The function is called in a loop repetitively, sometimes hundreds of times. The function is used in this call in such a way that the graphical part is not used but only somedatabase operations are performed (some rows are generated in the database etc.). The function is closed automatically after the operations are performed. The function works correctly, when it is called about under 150 times, but if it is called more than about 150 times, then a dialog message box with text "Your system is unable to allocate any more resource handles and 2 GUI controls could not be created. The application will now exit."

     

    How could one get rid of this error? I suspect that resources on the panel are not freed fast enough because the function is called in a fast loop. Could the solution be to free resources in sub Terminate? How could that be done, are there same kind of destructors for GUI components?

     

    Other solution would probably be to make a separate function with same functionality as the original function but remove GUI components, or change implementation language from C++ to RPG.



  • 2.  Re: Error: "Your system is unable to allocate any more resource handles and 2 GUI controls could not be created."
    Best Answer

    Posted Apr 28, 2015 02:40 AM

    Loving GUI problems as I do I would normally investigate but in this case I think you have answered your own question.

     

    Truly bad design. Simple. Move the logic to the server.



  • 3.  RE: Re: Error: "Your system is unable to allocate any more resource handles and 2 GUI controls could not be created."

    Posted Dec 10, 2025 08:54 AM
    Hello Plexperts,
     
    We're experiencing a major issue with GUI controls when our Plex application is launched on terminal servers.
     
    We've discovered that features using ActiveX controls are failing to release a significant portion of their GDI resources after closing. This is causing the application to be terminated by the system for some users throughout the day.
    If the error occurs, the following message will be displayed in our application:

     
     
    Environment

    • Development tool: CA Plex 7.2.1 (Build 24.004), WinC client)
    • GUI technology: WinC with ActiveX controls
    • 3rd party controls: DBI Technologies "Studio Controls R2"
      - ctSchedule
      - ctDate
      - ctButton
    • Deployment: Windows Terminal Server (multiple concurrent users)
    • OS: Windows Server (Terminal Server)
    • Client type: WinC panels hosting the ActiveX controls
     
    Problem description

    We are experiencing a resource exhaustion problem on our Windows Terminal Server when running a CA Plex WinC application that hosts DBI Studio Controls R2 ActiveX controls (ctSchedule, ctDate and ctButton).
     
    Symptom on the Terminal Server:
    • After some time and repeated use of certain WinC panels, users receive:
      "Your system is unable to allocate any more resource handles and X GUI controls could not be created. The application will now exit."
    • The WinC client then terminates and any open database connections are dropped.
     
    What we have measured

    We monitored the WinC process on the Terminal Server (Task Manager / Process Explorer):
     
    • Each time we open and then close a particular WinC panel that uses:
      - ctSchedule and/or
      - ctDate
      - ctButton
      the GDI handle count of the process increases by 100+ and does *NOT* return to the previous value after closing the panel 
    • After repeating this open/close cycle many times (or over longer user sessions on the Terminal Server), the process reaches a point when Windows refuses to create additional GUI controls and shows the above error dialog 
    • The behavior is *only* reproducible in panels that host the DBI ctSchedule/ctDate/ctButton ActiveX controls. Panels without these controls do not show this incremental GDI handle growth.
     
    What we have checked already

    • Our own CA Plex WinC code does not create GDI objects directly; the only obvious difference between "good" and "leaking" panels is the use of the DBI ActiveX controls.
    • Panels appear to be opened and closed correctly from the Plex side (no intentional reuse).
    • The GDI leak is huge when using ctDate or ctschedul (100+ per open/close cycle) but on a Terminal Server with many users and long-running sessions this is enough to eventually cause the resource handle error.
     
    Questions to the community
    1. Has anyone else experienced GDI handle leaks or resource handle issues in CA Plex WinC applications related to ActiveX controls (especially DBI Studio Controls R2, ctSchedule/ctDate/ctButton)? 
    2. Are there any known best practices or patterns in CA Plex WinC for:
         - Ensuring ActiveX controls are fully released when a panel is closed?
         - Explicitly forcing destruction / cleanup of embedded ActiveX controls? 
    3. Is there any known configuration or code pattern on the Plex side (WinC function lifecycle, panel close, user code exits) that we should pay particular attention to when hosting 3rd party ActiveX controls to avoid resource leaks? 
    4. Any experience specifically with DBI Studio Controls R2 and Terminal Server deployments would be very helpful:
      - Did you have to upgrade to a newer DBI product (e.g. Studio Controls COM/COM 64 with ctxSchedule/ctxDate) to resolve resource issues?
      - Any known issues or workarounds?
     
    Any hints or shared experience around ActiveX lifecycle in Plex WinC, GDI/resource handle leaks, or DBI controls in this context would be greatly appreciated.

    Best regards
    Klaus
    -------------------------------------------