Bar Series Bottom AxisLabels > Rectangle Memory Creep

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Tue Aug 21, 2012 10:56 am

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 14669 times
MemProfiler2.jpg
MemProfiler2.jpg (380.3 KiB) Viewed 14664 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
Attachments
WindowsFormsApplication2.zip
(51.72 KiB) Downloaded 439 times

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Wed Aug 22, 2012 5:51 am

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 14652 times

Using:
TeeChart .Net v2 2.0.3033.18431
Lasted TeeChart .Net 2012
Last edited by Diegoa on Wed Aug 22, 2012 7:41 am, edited 1 time in total.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Narcís » Wed Aug 22, 2012 7:40 am

Hi Diego,

The issue could be reproduce and is currently being investigated. We will post more information here ASAP.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Narcís » Wed Aug 22, 2012 9:50 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Wed Aug 22, 2012 10:00 am

Ok will test it out.

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Wed Aug 22, 2012 10:12 am

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 14589 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.

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Wed Aug 22, 2012 11:18 am

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.

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Thu Aug 23, 2012 6:24 am

Is there any fix for this memory leak issue with axis labels besides my workaround?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Narcís » Thu Aug 23, 2012 12:09 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Thu Aug 23, 2012 12:15 pm

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.
Last edited by Diegoa on Thu Aug 23, 2012 12:30 pm, edited 1 time in total.

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Thu Aug 23, 2012 12:24 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Narcís » Thu Aug 23, 2012 1:30 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Diegoa
Newbie
Newbie
Posts: 12
Joined: Tue Apr 24, 2007 12:00 am

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Diegoa » Fri Aug 24, 2012 8:08 am

Its creeping less now but still creeping about 2mb every 1 1/2 hours.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Narcís » Fri Aug 24, 2012 10:52 am

Hi Diego,

Thanks for the feedback. We will continue investigating the issue and will keep you posted here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Bar Series Bottom AxisLabels > Rectangle Memory Creep

Post by Narcís » Mon Aug 27, 2012 2:38 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply