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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top