-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
- .NET Core Version: 3.0 Preview1
- Have you experienced this same bug with .NET Framework?: Yes
Problem description:
Setting the MaxValue on the Trackbar control to a very high number results in excessive ram usage (in the gigabytes for a very large number).
This appears to be because on initialization of the underlying windows control, the maximum is set before the tick mark frequency, resulting in it initializing excessive amounts of tickmarks, although I do not have the build configuration to verify this theory myself at this time as if I did, I would just verify and submit this as a PR.
winforms/src/System.Windows.Forms/src/System/Windows/Forms/TrackBar.cs
Lines 893 to 894 in 01eef03
| SendMessage(NativeMethods.TBM_SETRANGEMAX, 0, maximum); | |
| SendMessage(NativeMethods.TBM_SETTICFREQ, tickFrequency, 0); |
Actual behavior:
Excessive ram is used (multiple gigabytes if compiled in x64)
Expected behavior:
A reasonable amount of ram is used (assuming you set tickmarks to a reasonable number).
Minimal repro:
Within a form
TrackBar tb = new TrackBar();
tb.TickFrequency = 0; //Ensure no tickmarks should be drawn
tb.Maximum = 1000000000;
this.Controls.Add(tb);