Page 1 of 2

Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Tue Aug 21, 2012 10:56 am
by 9644922
I am experiecing significant memory creep when updating bar values on a bar series. Running memory profile shows large amounts of Rectangles been created from the bottom AxisLabels. Reproducible on TeeChart .Net v2 and latest TeeChart .Net 2012
MemProfiler1.jpg
MemProfiler1.jpg (373.29 KiB) Viewed 14581 times
MemProfiler2.jpg
MemProfiler2.jpg (380.3 KiB) Viewed 14576 times
I know there was a similar issue before:

http://www.teechart.net/support/viewtop ... 88&start=0

Attached is sample project with the issue and screenshots of the memory profiler.

Can you help?

Regards,
Diego Acuna

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Wed Aug 22, 2012 5:51 am
by 9644922
Any feedback?

I have a client waiting for a resolution for this problem as the SCADA application is creeping 26-30 MB over night due to this memory leak in TeeChart.


MemProfiler3.jpg
MemProfiler3.jpg (405.4 KiB) Viewed 14564 times

Using:
TeeChart .Net v2 2.0.3033.18431
Lasted TeeChart .Net 2012

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Wed Aug 22, 2012 7:40 am
by narcis
Hi Diego,

The issue could be reproduce and is currently being investigated. We will post more information here ASAP.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Wed Aug 22, 2012 9:50 am
by narcis
Hi Diego,

What about implementing the project like this?

Code: Select all

      private Random __random = new Random();

      public Form1()
      {
         InitializeComponent();

         tChart1.Series[0].Clear();
         tChart2.Series[0].Clear();
         tChart3.Series[0].Clear();
         tChart4.Series[0].Clear();
         
         for (int a = 0; a < 5; a++)
         {
           tChart1[0].Add(0, "Value" + a, Color.AliceBlue);
           tChart2[0].Add(0, "Value" + a, Color.AliceBlue);
           tChart3[0].Add(0, "Value" + a, Color.AliceBlue);
           tChart4[0].Add(0, "Value" + a, Color.AliceBlue);
         }
      }

      private void timer1_Tick(object sender, EventArgs e)
      {
         for (int a = 0; a < 5; a++)
         {
           tChart1[0].YValues[a] = __random.Next(0, 100);
           tChart2[0].YValues[a] = __random.Next(0, 100);
           tChart3[0].YValues[a] = __random.Next(0, 100);
           tChart4[0].YValues[a] = __random.Next(0, 100);
         }

         tChart1[0].Repaint();
         tChart2[0].Repaint();
         tChart3[0].Repaint();
         tChart4[0].Repaint();
      }
It looks like the garbage collector keeps memory consumption in a constant range. Can you please check if that's the same at your end?

Thanks in advance.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Wed Aug 22, 2012 10:00 am
by 9644922
Ok will test it out.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Wed Aug 22, 2012 10:12 am
by 9644922
Sill same issue. System.Drawing.Rectangle is still climbing as before which is the main issue. It doesnt seem to be cleaned up or cleared at all from AxisLabels.labelpos (which I assume is an ArrayList) when they application is left open, which our client does.
Retention Graph.png
Retention Graph.png (28.21 KiB) Viewed 14501 times
Only workaround we got to avoid this leak it to turn off AxisLabel for Bottom Axis. Unfortunatly the client want to see the Bottom Axis labels.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Wed Aug 22, 2012 11:18 am
by 9644922
Clearing the labels like below before updating seems to cleanup the rectangles and they stop creeping:

Code: Select all

 private void timer1_Tick(object sender, EventArgs e)
      {
         (tChart1.Series[0].GetHorizAxis.Labels.Items.Clear();
         (tChart2.Series[0].GetHorizAxis.Labels.Items.Clear();
         (tChart3.Series[0].GetHorizAxis.Labels.Items.Clear();
         (tChart4.Series[0].GetHorizAxis.Labels.Items.Clear();

         for (int a = 0; a < 5; a++)
         {
            tChart1.Series[0][a].Y = __random.Next(0, 100);
            tChart2.Series[0][a].Y = __random.Next(0, 100);
            tChart3.Series[0][a].Y = __random.Next(0, 100);
            tChart4.Series[0][a].Y = __random.Next(0, 100);
         }         
      }
But this is still a dirty workaround for this memory leak.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Thu Aug 23, 2012 6:24 am
by 9644922
Is there any fix for this memory leak issue with axis labels besides my workaround?

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Thu Aug 23, 2012 12:09 pm
by narcis
Hi Diegoa,

We have a fix suggestion implemented. However,the project you attached doesn't use custom labels at all and Labels.Items is only used with custom labels. Therefore we find strange that calling Labels.Items.Clear() solves the issue at your end.

I see in our records that you have a TeeChart v2 license so I assume you are using an evaluation version of the latest TeeChart, is that correct? If that's the case we would compile an evaluation assembly for you. Could you please indicate the Visual Studio version you are using?

Thanks in advance.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Thu Aug 23, 2012 12:15 pm
by 9644922
Yeah we are licensed for TeeChart v2 (unlocked version) and we are evaluating the latest version as we plan to upgrade soon.

We currently using Visual Studio 2010 and our application is running on .Net 4.0.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Thu Aug 23, 2012 12:24 pm
by 9644922
Quick question with regards to backwards compatiblity.

We currently serialize our wrapped TeeChart v2 control using

MemoryStream memstream = new MemoryStream();
_chart.Export.Template.IncludeData = true;
_chart.Export.Template.Save(memstream);
return memstream.ToArray();

can this be deseralized into a .Net 4 TeeChart 2012 control using
_chart.Import.Template.Load(new MemoryStream(value));

i.e. is it backwards compatible?

I also been trying to get hold of Marc via email about upgrading soon, not sure if his around?

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Thu Aug 23, 2012 1:30 pm
by narcis
Hi Diego,
Yeah we are licensed for TeeChart v2 (unlocked version) and we are evaluating the latest version as we plan to upgrade soon.

We currently using Visual Studio 2010 and our application is running on .Net 4.0.
Ok, you can download a VS2010 evaluation assembly here. Please let us know if it fixes the issue for you.
We currently serialize our wrapped TeeChart v2 control using

MemoryStream memstream = new MemoryStream();
_chart.Export.Template.IncludeData = true;
_chart.Export.Template.Save(memstream);
return memstream.ToArray();

can this be deseralized into a .Net 4 TeeChart 2012 control using
_chart.Import.Template.Load(new MemoryStream(value));

i.e. is it backwards compatible?
Yes, you can export TeeChart template files in v2 and load them in v2012 (aka v4).
I also been trying to get hold of Marc via email about upgrading soon, not sure if his around?
He is on holidays this week, he will be back next week. For sales inquiries you can contact the Sales Dept. at sales at steema dot com.

Thanks in advance.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Fri Aug 24, 2012 8:08 am
by 9644922
Its creeping less now but still creeping about 2mb every 1 1/2 hours.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Fri Aug 24, 2012 10:52 am
by narcis
Hi Diego,

Thanks for the feedback. We will continue investigating the issue and will keep you posted here.

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Posted: Mon Aug 27, 2012 2:38 pm
by narcis
Hi Diego,

After further investigation we think the issue is finally fixed. I update the TeeChart evaluation assembly at the previous location. Can you please download and test it at your end?

Thanks in advance.