Hello,
we have a Memory Leak in Custom3DGrid.
Each access will let the memory grow.
Is there a knwon issue with Custom3DGrid?
System:
TeeChart Version 4.2020.5.25
IDE: VS2019
Language: C#
Windows 10 Pro 1909
Memory Leak Custom3DGrid
-
- Newbie
- Posts: 25
- Joined: Wed Jul 01, 2020 12:00 am
Memory Leak Custom3DGrid
Best regards,
HCC/KPM
HCC/KPM
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Memory Leak Custom3DGrid
Hello,
Despite being a public class, Custom3DGrid was not designed to be instantiated - it was designed as a base class, and as such is the base class of the classes ColorGrid, Contour, Surface, and Tower. Which of these four series types are you using? Could you please send us a Short, Self Contained, Correct (Compilable), Example (defined here) with which we can reproduce your issue?
Despite being a public class, Custom3DGrid was not designed to be instantiated - it was designed as a base class, and as such is the base class of the classes ColorGrid, Contour, Surface, and Tower. Which of these four series types are you using? Could you please send us a Short, Self Contained, Correct (Compilable), Example (defined here) with which we can reproduce your issue?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 25
- Joined: Wed Jul 01, 2020 12:00 am
Re: Memory Leak Custom3DGrid
Here you will find a sample project: https://hcckpm-my.sharepoint.com/:u:/g/ ... w?e=3Y6gGB
After each click the memory usage will grow. It will fall down after a few clicks but not to the starting point.
In the sample we use the ColorGrid.
We also tested the same behavior on a second system. That's the reason why it is not registered.
We also used the latest nuget downloadable version from September.
After each click the memory usage will grow. It will fall down after a few clicks but not to the starting point.
In the sample we use the ColorGrid.
We also tested the same behavior on a second system. That's the reason why it is not registered.
We also used the latest nuget downloadable version from September.
Best regards,
HCC/KPM
HCC/KPM
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Memory Leak Custom3DGrid
Hello,
I've modified slightly your project to use a timer (which fires twice a second) instead of manually using a mouse:
I then ran this code in a Memory Usage diagnostic session as detailed here using the latest publicly available version of Visual Studio 2019. I've uploaded the results here in the form of a *.diagsession file which you can open in Visual Studio 2019. The results look like this:
As you can see, this specific diagnostic session has failed to detect any kind of memory leak in the code.
I've modified slightly your project to use a timer (which fires twice a second) instead of manually using a mouse:
Code: Select all
/// <summary>
/// Interaktionslogik für MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private Steema.TeeChart.WPF.Styles.ColorGrid seriesCG;
private int clicks = 0;
private DispatcherTimer _timer;
public MainWindow()
{
InitializeComponent();
_timer = new DispatcherTimer();
_timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
_timer.Tick += _timer_Tick;
InitChart();
_timer.IsEnabled = true;
}
private void _timer_Tick(object sender, EventArgs e)
{
clicks++;
NewData();
}
private void InitChart()
{
Chart1.Legend.LegendStyle = Steema.TeeChart.WPF.LegendStyles.Values;
Chart1.Legend.Alignment = LegendAlignments.Bottom;
Chart1.Aspect.View3D = false;
seriesCG = new Steema.TeeChart.WPF.Styles.ColorGrid(Chart1.Chart);
seriesCG.PaletteStyle = Steema.TeeChart.WPF.Styles.PaletteStyles.Rainbow;
seriesCG.UseColorRange = false;
seriesCG.UsePalette = true;
seriesCG.Pen.Visible = false;
NewData();
}
private void NewData()
{
int arraySizeX = 512;
int arraySizeY = 360;
int arraySize = arraySizeX * arraySizeY;
short[] dataX = new short[arraySize];
short[] dataZ = new short[arraySize];
float[] dataY = new float[arraySize];
int index = 0;
int inv = 1;
if ((clicks % 2) == 0) inv = -1;
for (int x = 0; x < arraySizeX; x++)
{
for (int y = 0; y < arraySizeY; y++)
{
dataX[index] = Convert.ToInt16(x);
dataZ[index] = Convert.ToInt16(y);
dataY[index] = index * inv / 1000;
index++;
}
}
seriesCG.Clear();
seriesCG.Add(dataX, dataY, dataZ);
Chart1.Header.Text = clicks.ToString();
}
private void Chart1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
clicks++;
NewData();
}
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |