To many handles

One of my app’s is quit large. Making a change, or just selecting a control, results in flickering of the menu bar and freezing Xojo. The only solution is then using the task manager (also flickering) to stop Xojo and loading it again. Doing that it also sometimes happen that i can’t load it and the message “The current process has used all of its system allowance of handles for Window Manager objects.” follows. I tried if removing controls helps but most times everything gets worse.
Can anyone give me a solution how to manage this problem? Also, is there a way you can find out how many handles your program is using? Thank you.

What version are you using. A number of issues in the past have been described in a similar way to this. One was caused by a progress bar with max defined with a very large number. This causes the control to “draw” more lines than could fit within its bounds. I’m sure there were other issues like this also.

Is this slowness only when you are in the Window editor or the code editor? I’ve also heard that the code editor has problems if a single method gets beyond 64K or so, at which point you are advised to split the method into smaller pieces.

Windows with 1000s of controls is another issue. splitting areas off to Container controls (or rethinking the interface) was a suggestion.

I’m sure others will come in with similar issues that could help.

1 Like

So in Windows, every window, every control, every graphics object, every picture may need a handle and Windows itself manages a table for these to map them to the actual objects.
Seems like your app accumulates a lot of handles by e.g. not releasing windows, controls, and graphics objects.
Maybe you have circular references, so a closed window will not get destroyed and the handle freed.

I thought this was talking about Xojo being slow and having the issue, rather than the generated app?

You may then fill an issue and ask Xojo Inc. to hunt for unreleased handled in the IDE project.

You can see this in the TaskManager on the Details Tab. But you need to add the Handles Column once before you can see it. Just right Click on the Header of this Table/List and select “Choose Columns”. :slight_smile:

Thank you very much, everybody who replied on my ask for help. I am using Xojo 2023 r1.1. I read the reply’s something about slowness but the problem is not when running the app but when changing something. Mostly when clicking at the left side on one of the controls. For example when i want to add a event handler.
Ian, i never used container control and will take a look if that helps.

Further details, in my app i use no menu bar but tab panels. One main tab panel, on each tab a new tab panel. To have a colored background i place a rounded rectangle on each tab. The labels, bevelbuttons, textfield’s, listboxes en so on, are placed on the rounded rectangles. Could this workaround be part of the problem?

Thank you for your help.

Thank you Sacha, a good tip.

1 Like

Christian, thank you. Sorry i forgot to mention that the problem is only when designing the app and changing something in the layout.

Could you tell us how much RAM you have and if you have other memory intensive apps running?

It would also be helpful to know if you have a lot of resources embedded in your project. Things like pictures, sounds and videos, dragged right into the navigator.

How many controls are we talking about? Is it more like 10, 100, 1000… ?
Have you considered re-designing the windows to use Container Controls rather than controls on a tab panel?

Rather than using a Round rectangle there is a GroupBox control specifically for this sort of purpose. It can optionally have a title at the top or not.

Using this it would also adapt to different OS versions and platforms automatically.

A common approach is to place the controls for a given tab into a Container Control and then the main window has the tab panel and once container control on each of the tabs. It not long lightens the burden on the Window editor it makes your life somewhat easier for editing the container as you don’t have to worry about dealing with multiple tabs all the time.

My computer has 8GB RAM, 256 GB SSD plus 1 TB Hard drive.
On Window1 i have 1135 controls, 335 methods and 576 properties.
Also 18 windows as a modal window for filling in a form, giving a message and so on. There is a Graphics map with 6 png pictures.

There are no other app running. My computer runs on Windows 10 64 bit.
Because of my problem i bought a (refurbished) computer with 24 GB ram, 512 GB SSD and 3 TB hard disk. Only to test if the memory would be the problem. But it doesn’t make any difference.

I really appreciate that you are willing to pay attention at my problem. I started programming with Atari long ago. Most problems i can resolve but this is new for me, not related to a programming issue but to Windows.

I suggest you re-think how this window is put together as this is a lot for a single window.

1 Like

Wow, that’s…not ideal.

However, you should also send this file to Xojo so they can test - it sounds like a great opportunity for them to make improvements in the IDE’s performance.

1 Like

Yowsa. I would certainly think about using a ContainerControl for each panel. It should help a lot.

1 Like

Thank you all for your help. I looked at the container control and think using only 1 tab panel on Window1 with on each (of 9 tabs) a container control. On each of the 9 container controls a new tab panel with all the controls needed on the tabs of those panels.

If someone of you has used container controls in such a way and can give me more tips i would be very thankful.

ADDING more controls is only going to make things worse. :expressionless:

The suggestion of using container controls is only valid IF the window does not have the controls when you open it and you ADD and REMOVE the container controls as needed

BUT, to be clear, this is a BAD desig and you should avoid it. No one is going to use the 1135 at the same time. You can have only the basic user interface in the window and for detailed changes you can use either a container control loaded at run time or a secondary window with the specific controls needed for the task.

Thank you Ivan.
If i understand you right it would be no problem to make 9 container controls and when i later choose a tab embed the container for that tab on that panel. When i leave that panel the container must be removed, dis embedded or something like that.
For us, i am music publisher, it would be very handy to have one app with witch we can do all the daily work. It was possible with VB6.