0

We have to handle leaks in our application.

We are testing some viewers in our application for some 200 open and close,and found that the handles count is around 200.

For the same viewer the memory usage is constant and also the GDI count is also constant.

The thing is that the handles are increasing each time, but is not constant. Sometimes it is increasing by 5, sometimes by 1 and sometimes it is decreasing. We were not able to see a constant increase as that of GDI leaks.

We have already unsubscribed all the events registered in the application and also disposed all the controls used in the application. Before some memory leak was also there in the application. After disposing all the controls now it remains constant.

So what are all things else we need to check in this case. We are little confused since the memory/GDI count is constant while the handles only increasing.

Any suggestions appreciated.

Adel Khayata
  • 2,717
  • 10
  • 28
  • 46
Mahesh KP
  • 6,248
  • 13
  • 50
  • 71

1 Answers1

1

Use a tool like Process Explorer to examine the handles your process has open. Select your process from the list and go to View > Lower Pane View > Handles. By default, the lower pane shows only the named handles. You can go to View > Show Unnamed Handles and Mappings to show them all.

Mike Zboray
  • 39,828
  • 3
  • 90
  • 122
  • Previously i tried this tool also. But from it how we will undesrtand which section in our project is making leaks? – Mahesh KP Jul 26 '13 at 05:38
  • @mahesh The first thing you should do is try to find what kind of resource handle you are leaking. It could be a file, registry key, mutex, or some other resource. Then you need to think about where in your application those resources are allocated and released. – Mike Zboray Jul 26 '13 at 19:03