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?
m_tchart.Series.Clear(); // Garbage collections issues.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Digital,
Yes, that's right. Which was the problematic code?Is this the way it should work?
Best Regards,
Narcís Calvet / 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 |
m_tchart.Series.Clear(); // alone is the problem
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.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Digital,
Ok, then you can try RemoveAllSeries:
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Digital,
No.m_tchart.Series.RemoveAllSeries(); // This is not obsolete
This doesn't exist in the .NET version contrary to the VCL version.or is it that m_tchart.RemoveAllSeries(); is obsolete.
Best Regards,
Narcís Calvet / 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 |