-2

I have a WPF Prism application where the number of handles in Task Manager increases continuously while the app is in usage. We sometimes get the following error after the app has been running for 24 hours: "The current process has used all of its system allowance of handles for Window Manager objects."

what do I look for to clean up the leaks. We are using Windows 7.

Ray
  • 4,679
  • 10
  • 46
  • 92
  • Relevant: http://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 – tnw Aug 14 '14 at 19:54
  • This link answers your question about maximum number of handles: http://blogs.technet.com/b/markrussinovich/archive/2009/09/29/3283844.aspx – Anshul Aug 14 '14 at 19:59
  • 3
    You should not be checking for the limit, you should be checking your code for the handle leak. – Hans Passant Aug 14 '14 at 21:19
  • Where should I be looking? I found it to be when I print a particular report repeatedly. I notice the number if handles increasing every time I print the report. But I don't know which classes I should be looking for for leaks. – Ray Aug 15 '14 at 13:26
  • @Ray - you should look at the classes that are used when you print that report... not sure what deeper insight you'd expect us to provide with the information you've given. – Robert Levy Aug 23 '14 at 02:51

1 Answers1

0

Not sure what version of Windows you're using, but the process max for GDI/User handles is 10,000 on Win2k: http://support.microsoft.com/default.aspx?kbid=326591

and XP: http://support.microsoft.com/kb/327699/en-us

You can view the process handle count by adding a handle count column to Task Manager.

Possibly related post here: What's the upper limit on GDI objects for one process in Windows 7?

and here: What are Windows "USER objects"

HTH!

Community
  • 1
  • 1
Paully
  • 166
  • 2
  • 3
  • Are you sure the limit is 10000? Because when I look in Task Manager, the handles goes as high as 40000 and then things start slowing down and crash. – Ray Aug 23 '14 at 02:17
  • Yes: I'm sure this is what the referenced documents state. The question of Handle limits is answered in detail by @derek-park in detail in this thread: [link](http://stackoverflow.com/questions/9723470/whats-the-upper-limit-on-gdi-objects-for-one-process-in-windows-7) If you need to investigate the nature of the handles being generated by your WPF app, you might try using Handle.exe, free from sysinternals: [link](http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx) – Paully Aug 23 '14 at 14:30