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

    Question

  • hello,

    I get an error message which says like "The current process has used all of its system allowance of handles for Window Manager objects" that i dont know what it its. I have winForm project and it works fine but after sometime it raised this error.

    I really need help on this.

     

    Tuesday, October 05, 2010 11:58 PM

Answers

  • You can use Task Manager's View menu, Select Columns.  Turn on "USER Objects".  (Here, USER means "user interface", as in user32.dll, the main GUI library in Windows.)  Go to the Processes tab.  Monitor and make sure your process is a team player and does not use too many more objects than other major applications like MS Word, Internet Explorer, etc.  IIRC, the limit is 10000 USER objects per process but you should avoid getting anywhere near it as there is also a session-wide limit that is too close for comfort to the per process limit.

    (If you can't account for a high number, make sure that you do not have any forms hidden but still referenced by live variables.)

     

    Wednesday, October 06, 2010 2:07 AM
  • Open task manager and in view=>select columns, choose to show handle columns.

    Now do something in your program to see what cause an massive increase in handle count, and check for leaks in that part of code.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Wednesday, October 06, 2010 2:02 AM
  • Looks like you have a handle leak. Check which action can cause an increase in handle count and investigate the related code.

    It may help if you can get a professional profiler to see what is in memory.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Wednesday, October 06, 2010 4:23 PM
  • You might want to try HeapMon to monitor your object handles. A common cause of this problem is when there are lot of dynamic object creation and improper disposal.

    Try looking in your code where controls are created, and try to properly disposing them with calls to Dispose method and updating it's references to null. See if that solves your problem as these no longer used controls might still have references on the code so they can't get collected by the garbage collector.

    Also try to call GC.Collect() after disposing your objects.

     

    I hope this helps.

    Regards,

    Fábio


    "To alcohol! The cause of and solution to all of life's problems." - Homer Simpson
    Monday, October 11, 2010 9:08 PM

All replies

  • Open task manager and in view=>select columns, choose to show handle columns.

    Now do something in your program to see what cause an massive increase in handle count, and check for leaks in that part of code.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Wednesday, October 06, 2010 2:02 AM
  • You can use Task Manager's View menu, Select Columns.  Turn on "USER Objects".  (Here, USER means "user interface", as in user32.dll, the main GUI library in Windows.)  Go to the Processes tab.  Monitor and make sure your process is a team player and does not use too many more objects than other major applications like MS Word, Internet Explorer, etc.  IIRC, the limit is 10000 USER objects per process but you should avoid getting anywhere near it as there is also a session-wide limit that is too close for comfort to the per process limit.

    (If you can't account for a high number, make sure that you do not have any forms hidden but still referenced by live variables.)

     

    Wednesday, October 06, 2010 2:07 AM
  • Thanks for your helpful response Guys,

    I have added the Handler and User Object columns in the task manager and started playing with the application. It shows that the User Objects are increasing with a very high rate. Based on this fact I can tell with in a day it might even exceed the limit of USER OBJECTs per process since a user mght open and use the application for a couple of days or weeks even more than that in a row with out closing it.

    But what should I do inorder to solve this problem? Thanks for your help.

    Wednesday, October 06, 2010 4:08 PM
  • Looks like you have a handle leak. Check which action can cause an increase in handle count and investigate the related code.

    It may help if you can get a professional profiler to see what is in memory.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Wednesday, October 06, 2010 4:23 PM
  •  

    Hi,

     

    How is this problem now?

     

    Best regards,

    Ling Wang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Friday, October 08, 2010 9:20 AM
  • Sory Guys,

    I was sick for z last couple of days. I still need a tool to identify the leaked user object. Do you know any?

    Thanks for following up.

    Monday, October 11, 2010 3:15 PM
  • You might want to try HeapMon to monitor your object handles. A common cause of this problem is when there are lot of dynamic object creation and improper disposal.

    Try looking in your code where controls are created, and try to properly disposing them with calls to Dispose method and updating it's references to null. See if that solves your problem as these no longer used controls might still have references on the code so they can't get collected by the garbage collector.

    Also try to call GC.Collect() after disposing your objects.

     

    I hope this helps.

    Regards,

    Fábio


    "To alcohol! The cause of and solution to all of life's problems." - Homer Simpson
    Monday, October 11, 2010 9:08 PM
  •  

    I am trying to check if its actually creating a handle leak using Performance Monitor. But if I find out it exists, I will step over to identifying the leaked object.

    Thanks Guys and let you know

    Tuesday, October 12, 2010 8:16 PM
  • The problem was there were objects and object collections which was not clearly disposed and when I dispose all the objects used in each window and class explicitly the problem becomes solved.

    Thanks for following up. you lead me to the exact location.

     

    Thursday, November 04, 2010 5:46 PM