![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Memory leak disposing & recreating empty Chart | ||
|---|---|---|---|
| Product: | .NET TeeChart | Reporter: | christopher ireland <chris> |
| Component: | Direct2D | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | --- | ||
| Version: | TeeChart.NET 2014 4.1.2014.02060 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
The following code leaks memory: TChart tChart = null; Graphics3DDirect2D D2D = null; protected virtual void CreateCharts() { tChart.Dock = DockStyle.Fill; tChart.Panel.Gradient.Visible = false; tChart.Panel.Color = Color.Black; tChart.Panel.Gradient.Visible = false; tChart.Walls.Visible = false; tChart.Axes.Left.Grid.UseStyling = false; tChart.Axes.Bottom.Grid.UseStyling = false; // comment below line for gdi setD2D(tChart); //tChart.Series.Add(new FastLine()); //tChart.Series[0].FillSampleValues(500); } private void setD2D(TChart chart) { D2D = new Graphics3DDirect2D(chart.Chart); D2D.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel; D2D.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; chart.Graphics3D = D2D; chart.Graphics3D.BufferStyle = BufferStyle.None; } void Create() { tChart = new TChart(); tChart.Dock = DockStyle.Fill; CreateCharts(); panel1.Controls.Add(tChart); } void CloseChart() { panel1.Controls.Remove(tChart); if (tChart != null) { tChart.Dispose(); GC.Collect(); } } private void timer1_Tick(object sender, EventArgs e) { CloseChart(); Create(); }