Crashing

I have a program that consists of one window with a LOT of controls on it (which may or may not be a factor) which runs when opened the first time and sometimes thereafter. It usually crashes after three or four runs. It’s Windows 10 Pro. I’m running the latest Xojo (2023 r1.1) but have tried it with 2022 versions to same result. I have all my methods, properties tied to this window.

I’ve tried shutting off all the processes I can except for Dropbox which I think I remember someone in the past saying it can interfere. I have OneDrive running but am loading the program from the Desktop.

I’m a hobby programmer so I don’t know all the correct nomenclature and when I searched for similar issues I got lost in the weeds. I guess my question is, is this a problem for others?

First of all, is this a crash or an exception?

Crash. Everything shuts down: my app and Xojo, that is. Doesn’t crash Windows.

One time I got an error message – didn’t write it down because, strangely, my app ran and I didn’t discover the message until I quit it.

Open the Windows Task Manager and keep an eye on the memory usage, handles, user objects and GDI objects counters to see if they keep increasing.

Not sure what all that means but I have looked at Background Processes and Windows Processes and, so far, not much change.

There should be an entry in the task manager process list for your application. You should see various columns relating to memory usage, handles etc… (if not you can customise the list and add the columns).

If you have a leak of some kind then these values will continue to grow.

For example, you will get a crash when you hit approx. 10,000 GDI objects. If you application is 32 bit then it will crash at around 3GB of memory.

Thanks. I’ll check.

With my app running here’s what I see:

The crash only occurs when starting. If it makes it past the initial stage, all is fine. Never crashes once in the app.

OK. I very much doubt its a leak.

If you are using any pragma commands I would comment those out as they could be hiding an exception.

Then add debug messages to the start and end of the methods which are called during startup.

This should hopefully help you determine where about the crash is occurring.

Great idea on the methods at startup. Thanks.

Also check the log of events (Event Viewer), maybe something about the crash can be logged too.

1 Like

Well, actually I don’t have any methods at Startup. The whole program is just one window, no libraries, nothing called at Startup, etc. So that method of discovery appears to be a dead-end.

Wait, I must emend that: there is one other window that is called from within. Maybe there’s a problem there.

What about code in the window or control events, code in any custom controls in the window.

Well, I have over 200 “controls” on my window. That is, over 200 textareas, buttons, up/down arrows, labels, etc. Many of them have code. Is there a limit on how many controls you can have on one window?

At startup, their Opening events will fire, plus that of the window and the app itself. Do you have any of those?

I have one Opening event for the Main window. I tried a break at the front end of it to no avail.

Do you have antivirus running that could be killing the app?

Only Windows Security. I’ve been suspicious of OneDrive at various times in the past.

Tonight I got the Runtime Error message again and was able to save it. Here it is:

image