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

A couple of Windows clients are getting this exception on my app. The app is not opening multiple windows but it doing a lot of processing of an incoming XML file and possible lot of concurrent updating of a listbox.

Any ideas good community?

You can use Task Manager to see the # of handles allocated in your app in realtime. You may try looking at this value while using your app, and see if you can make the # go up consistently. That would suggest something is leaking handles.

Your app can monitor its resource usage with our WindowsGUIResourcesMBS class.

Here’s another option:

https://social.msdn.microsoft.com/Forums/windows/en-US/73aaa1f3-30a7-4593-b299-7ec1fd582b27/the-current-process-has-used-all-of-its-system-allowance-of-handles-for-window-manager-objects?forum=winforms

Window Manager objects would be:

  • controls
  • threads
  • timers
  • sockets

What version of Xojo? What version of Windows?

Thanks everyone!

Looks like it doesn’t like having a few thousand timer objects. I’ve been using them to defer updating the UI when a change comes in (to let the rest of the changes come in and get changes back on the main thread.) Basically the code instantiates a new timer that then calls back to the update method.

I’ll try Xojo.Core.Timer.CallLater and see if it fairs better in resource usage?

I’ve also seen that error when changing the mode of a smaller number of timers a lot: <https://xojo.com/issue/49907>

What I ended up doing to avoid it was to wrap line that change timer modes in a test:

if theTimer.Mode <> Timer.ModeX then theTime.Mode = Timer.ModeX end if

Well, using xojo.core.timer.calllater doesn’t improve it.

Tom: I’ll take a look at your suggestion. PS - that ticket seems to be private

I wonder why I did that? I’ve added a comment to it to ask Xojo to make it public in case you have anything you want to add to it.