Problem Loading Large Configuration in Windows

Hey all,

I’m having a problem reported by a customer and validated by me for a configuration of my app that includes a large number of controls. In this particular case we are looking at about 324 controls being added. Not all controls are visible - some are located outside the visible bounds of the container control they are in and get scrolled into view. I’m getting the following exception error:

The current process has used all of its system allowance of handles for Window Manager objects.

Under OS X, the app is zippy and has no problems with this many controls. And I’m running in 64 bit so I have a hard time understanding how I’ve used up all my resources. Maybe someone can give me some insight here?

What am I doing wrong? Things work fine with a smaller set of controls. But when it gets large, bad things happen…

Ouch !

I suppose you do not wanted to create many windows with far less Controls each (or is it the Client ?).

No, no. That’s not possible. This is a control system for a video matrix. This particular customer has 108 video screens in their network operations center that need to be controlled. Some clients have a handful of screens, others like this have many. So we adjust everything for what the user needs. Here’s a screen shot from OS X where it works.

The user can click on one of the screens and gets a menu of what video source they want to display on that screen.

Anyhow, I just thought about putting each video screen control and it’s corresponding label fields into a container control. And then adding the container controls to the window. That would cut down on the number of individual controls on the particular window. I wonder if that would work? Maybe a windows expert can chime in.

theyre not already ?
wow

[quote=460240:@Norman Palardy]theyre not already ?
wow[/quote]

No. For each TV screen you see there, we have a label of the screen name and then once the video source is selected, we have a source name that shows up beneath the TV icon. In my web version, all three of these are in a container control. I actually did that because we used to have different interfaces for mobile devices (phones, iPads, etc) and one for a desktop. However, now since Apple has made an iPad a “desktop” that screwed me up. But I digress…

All those controls are in a container that is on the window. But would I reduce the number of handles used by a third if I put all the items for each video screen into a container control? Or would I be adding handles since now I have the handle for each container control?

Seems that there is 10000 limit of resource handles. If your system is not disposing them correctly, leaking handles, such thing occurs. Handle leaking can be your fault or Xojo fault. You need to investigate deeper. https://forum.xojo.com/49403-the-current-process-has-used-all-of-its-system-allowance-of-han

unless your crashing into some 32 bit memory limit I would not sweat the extra 4k you might need for additional references
make your code maintainable and manageable
a cc per screen would seem to do that

[quote=460247:@Norman Palardy]unless your crashing into some 32 bit memory limit I would not sweat the extra 4k you might need for additional references
make your code maintainable and manageable
a cc per screen would seem to do that[/quote]

No. I’m running 64bit. So there should be plenty of resources. But as Rick above points, out, there’s a limit of 10,000 resource handles. So would adding container controls really help that?

It’s easy to watch handle allocation in Windows Task Manager (on the process view you can add a column showing it). You can then run your app, open/close windows etc. and make sure that handles are getting released properly.

Finding why they aren’t released is not always easy, but at least you have a way to test.

I’m only using 347 handles, but I also showed the User Objects column which shows I have 10,000 user objects.

A listbox, 6 columns and custom cell paints, one control ? 100k screens and still one control.

Not sure I understand??

347 is not really that high, most of the time, that error is most likely some resource leak, maybe something is being created and not destroyed.

But, for your particular case, it is a waste of resources having all those. You should use a custom control:

One option is what Julian said, each cell is a tv control and you draw the icon in the cell paint event. (He said 6 colums to be like your screenshot)

I also made something similar with a custom canvas, still a single control and unlimited number of virtual ones, more work than the listbox but much more flexible.

Another option I did in another platform, a sort of recicled views. For example, in your screenshot, you just need 60 controls, as you scroll, you reuse the ones that got out of view.

I get what Julian is saying now. But a listbox won’t work as I have an option where a user can drop a graphic such as a floor layout onto the screen and then move the individual screens around to match where they are in real life. They are all custom controls by the way. I also dynamically resize the screen so if I widened the screen, it would have more columns and less rows.

And I could see myself having 347 handles as in the case when I took this I have 3 sets of 108 controls which is 324. Plus then I have a number of other items on the window as well. But what is crashing is the 10,000 user objects. That doesn’t seem right. That means I would have 28 objects per control which seems like something is not happening correctly.

I just wish Windows could be like Mac OS. On MacOs, this thing pops up in a fraction of a second all ready to go. No issues.

handles ? user objects in Xojo

I get that. So does the UserObjects field in TaskManager = objects in Xojo?

That 9999+ you saw, points out that you reached the OS UI Objects (each one has its own handle) limit.

That’s a lot of objects. Seems some kind of leaking.

that is more acurate. You can start your app sith a few controsl, add more, remove them, and see if the UserObjects number goes down, try to play around and see if you can find a leaking.

Nooo, maybe mac is more permisive, but, If you have a leaking, it is better if the system put you a stop so you can find it and fix it

I am doing right now exactly what Ivan is suggesting. I’m down to 2 video screens and 2 video sources, but I still see the UserObject count in Windows being 347 and 360. GDI objects is 96. So something isn’t right. But what is the correspondence between user objects in Windows and Xojo objects? If I have a toolbar like I have is that one object or multiple? If I open another window then my object count is going to increase, yes? Seems like something isn’t right. I’ll have figure this out…