Excessive memory usage by comctl32.dll when a checkbox control's Visible becomes true

有些话、适合烂在心里 提交于 2020-01-23 10:51:08

问题


I am adding controls to a Windows Form during runtime in a C# .NET application. Each of these controls interacts with a particular signal and uses some data from that signal -- signal name, description, source, units, value, etc.

These controls have a check box on them. When the Visible property of the checkbox of just one of these signals becomes true, my application's Committed memory jumps over 800MB. None of the other hundreds of signals have the problem.

I used the DebugDiag tool to learn that comctl32.dll is allocating 805.45 MBytes. In particular:

  • Function comctl32_72380000!CCHeapAllocArraySize+3a
  • Allocation type Heap allocation(s)
  • Heap handle 0xf37893cd
  • Allocation Count 1 allocation(s)
  • Allocation Size 803.20 MBytes
  • Leak Probability 16%

What should be my next troubleshooting steps? What tools can help?

Update: I tracked the problem to a System.Windows.Forms.TrackBar on the parent control. The track bar had a maximum over 200,000,000. When I decreased the maximum to 100,000,000, it used about half the memory. Setting the maximum around 1,000,000 used a more reasonable amount of memory.


回答1:


I tracked the problem to a System.Windows.Forms.TrackBar on the parent control. The track bar had a maximum over 200,000,000. When I decreased the maximum to 100,000,000, it used about half the memory. Setting the maximum around 1,000,000 used a more reasonable amount of memory.

The checkbox.Visible threw me off. It appears that the applications was creating the control and the memory for it at the point the checkbox.Visible became true, but the checkbox itself had nothing to do with the problem.



来源:https://stackoverflow.com/questions/15206654/excessive-memory-usage-by-comctl32-dll-when-a-checkbox-controls-visible-becomes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!