m_tchart.Series.Clear(); // Garbage collections issues.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Digital
Newbie
Newbie
Posts: 11
Joined: Tue Apr 08, 2003 4:00 am

m_tchart.Series.Clear(); // Garbage collections issues.

Post by Digital » Fri Feb 25, 2005 7:38 pm

I am loading very large amounts of data (well over 5MB per array of data) to be displayed. I have a button that I use to clear the chart. When I monitor my App's memory usage it does not seem to be reclaiming all the memory when I clear the chart. Inside my ClearChart() function I call m_tchart.Series.Clear(); but this does not seem to help. I did some experimenting and found that the putting the following code in my ClearChart() function works and memory is reclaimed:
for(int i = 0; i < m_tchart.Series.Count; ++i)
{
m_tchart.Series.Clear();
}
m_tchart.Series.Clear();

I am using the Fastline Series, Visual Studio .Net 2003, with Version 1.1 SP1 of the .Net Framework.

Is this the way it should work?

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

Post by Narcís » Mon Feb 28, 2005 12:46 pm

Hi Digital,
Is this the way it should work?
Yes, that's right. Which was the problematic code?
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

Digital
Newbie
Newbie
Posts: 11
Joined: Tue Apr 08, 2003 4:00 am

m_tchart.Series.Clear(); // alone is the problem

Post by Digital » Mon Feb 28, 2005 2:33 pm

m_tchart.Series.Clear(); alone is the problem. If I call only this line the memory does not seem to be reclaimed. I thought this method is supposed to clear and dispose of all series the then remove them from the chart. I does remove them from the chart but memory seems to hang around unless I manally loop through and clear each series one by one prior to the call to m_tchart.Series.Clear(); Only clearing the series one by one manually followed by the call to m_tchart.Series.Clear(); seems to allow the memory to be reclaimed.

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

Post by Narcís » Mon Feb 28, 2005 2:57 pm

Hi Digital,

Ok, then you can try RemoveAllSeries:

Code: Select all

m_tchart.Series.RemoveAllSeries();
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

Digital
Newbie
Newbie
Posts: 11
Joined: Tue Apr 08, 2003 4:00 am

obsolete?

Post by Digital » Mon Feb 28, 2005 3:14 pm

m_tchart.Series.RemoveAllSeries(); // This is not obsolete?

or is it that m_tchart.RemoveAllSeries(); is obsolete.

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

Post by Narcís » Mon Feb 28, 2005 3:21 pm

Hi Digital,
m_tchart.Series.RemoveAllSeries(); // This is not obsolete
No.
or is it that m_tchart.RemoveAllSeries(); is obsolete.
This doesn't exist in the .NET version contrary to the VCL version.
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

Digital
Newbie
Newbie
Posts: 11
Joined: Tue Apr 08, 2003 4:00 am

Thanks

Post by Digital » Mon Feb 28, 2005 3:33 pm

Thank you for your help.

Post Reply