TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
FH Nürnberg
- Newbie
- Posts: 8
- Joined: Thu Nov 18, 2010 12:00 am
Post
by FH Nürnberg » Fri May 20, 2011 9:25 am
Hallo everybody, I have a problem with the memory in the pocket Pc Version.
Every second i update the chart, eventually with another chart typ (line, bar, ...):
Code: Select all
private Timer timer = new Timer();
public Form1()
{
InitializeComponent();
InitializeChart();
}
Steema.TeeChart.Styles.Line line1;
private void InitializeChart()
{
tChart1.Legend.Visible = false;
tChart1.Aspect.View3D = false;
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.DoubleClick += new EventHandler(tChart1_DoubleClick);
timer.Interval = 1000;
timer.Enabled = true;
timer.Tick += new EventHandler(timer_Tick);
}
void timer_Tick(object sender, EventArgs e)
{
tChart1_DoubleClick(null, null);
}
void tChart1_DoubleClick(object sender, EventArgs e)
{
tChart1.Clear();
tChart1.Series.Clear();
tChart1.Series.Add(line1);
Random rnd = new Random();
tChart1.AutoRepaint = false;
line1.Clear();
line1.Add(rnd.Next(100));
for (int i = 1; i < 20; i++)
{
line1.Add(line1.YValues.Value[i - 1] + rnd.Next(10) - 5);
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
}
After 5 min the memory on my Pocket PC is on an critical state.
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Fri May 20, 2011 2:00 pm
Hi FH Nürnberg,
I have been running your code here for about 10 minutes without problems. I'm using Visual Studio 2008 with built-in USA Windows Mobile 5.0 Pocket PC R2 Emulator. Garbage collector seems to do its job with DeviceEmulator.exe. It uses 128 MB RAM:
- PocketPCEmulator.jpg (70.26 KiB) Viewed 8032 times
Which environment are you using? Do you use a device or an emulator? How much memory does it use? Can you reproduce this using an emulator? During how many time do you have to run the app?
Thanks in advance.
-
FH Nürnberg
- Newbie
- Posts: 8
- Joined: Thu Nov 18, 2010 12:00 am
Post
by FH Nürnberg » Mon May 23, 2011 6:53 am
Hallo Narcis,
I use the Visual Studio 2008 Professional Edition, with the Pocket PC 2003 SE-Emulator, with 64 MB RAM.
I modified the Emulator that the video output are 640 x 480 Pixel, the same as my device.
After 9 min the program has an OutOfMemory Exception in the line “tChart1.Clear()” the first line in tChart1_DoubleClick.
Under properties => storage => I found the total data / program storage, at the beginning it has 29.7 MB.
-
FH Nürnberg
- Newbie
- Posts: 8
- Joined: Thu Nov 18, 2010 12:00 am
Post
by FH Nürnberg » Mon May 23, 2011 6:59 am
PS: I run the program alone (only I open the window "properties => storage" to see the RAM status.
I measured the 9 min with my watch and the error is reproduceable.
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Tue May 24, 2011 9:57 am
Hello FH Nürnberg,
Can you please check if you can reproduce the problem using exactly the same emulator that uses Narcís?
Thanks,
-
FH Nürnberg
- Newbie
- Posts: 8
- Joined: Thu Nov 18, 2010 12:00 am
Post
by FH Nürnberg » Tue May 24, 2011 10:51 am
I have try to run the sample with the "GER Windows Mobile 5.0 Pocket PC Emulator" but after the synchronation with the PC.
An error appears that the Version of Microsoft .Net Compact Framework not correct is.
I don`t know why this emulator doesn´t work.
The Emulator "Ger Windows Mobile 5.0 Smartphone R2 QVGA Emulator" after 4 Min the program close with out a warning.
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Tue May 24, 2011 3:58 pm
Hello FH Nürnberg,
Ok. In first project I can reproduce your problem using last version of TeeChart.Net and
VS2008 Pocket PC 2003 SE-Emulator, with 64 MB RAM:
In second project doesn't reproduce your problem here using last version of TeeChart.Net and
VS2008 USA Windows Mobile 5.0 Pocket PC R2 Emulator, with 128 MB RAM:
Please, can you check two projects and confirm us if in both appears your problem?
Moreover, you can tell us which version of TeeChart are you using now?
Thanks,
-
FH Nürnberg
- Newbie
- Posts: 8
- Joined: Thu Nov 18, 2010 12:00 am
Post
by FH Nürnberg » Wed May 25, 2011 6:51 am
Hallo Sandra,
the first project crushed after 9 min with OutofMemory. The second doesn´t run because I use the "Ger Windows Mobile 5.0 Pocekt PC R2 Emulator" and the compact framework can´t update.
I use the TeeChart version 4.1.2011.4192
with the runtime version v2.0.50727
Thanks,
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Thu May 26, 2011 11:04 am
Hello FH Nürnberg,
Ok. We have reproduced the same problem using WinForms application and we found that its a memory leak in the TChart.Clear(). We have fixed it for next maintenance release and at the moment you can use next workaround:
Code: Select all
private void TChartClear()
{
tChart1.Chart.Dispose();
tChart1.Chart = new Steema.TeeChart.Chart();
tChart1.Chart.Parent = tChart1;
tChart1.Chart.Parent.SetChart(tChart1.Chart);
tChart1.Chart.Parent.DoSetControlStyle();
tChart1.Chart.Parent.DoInvalidate();
}
void tChart1_DoubleClick(object sender, EventArgs e)
{
TChartClear();
//tChart1.Clear();
tChart1.Series.Clear();
tChart1.Series.Add(line1);
Random rnd = new Random();
tChart1.AutoRepaint = false;
line1.Clear();
line1.Add(rnd.Next(100));
for (int i = 1; i < 20; i++)
{
line1.Add(line1.YValues.Value[i - 1] + rnd.Next(10) - 5);
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
}
Please, can you confirm us if previous code works as you expected?
Thanks,
-
FH Nürnberg
- Newbie
- Posts: 8
- Joined: Thu Nov 18, 2010 12:00 am
Post
by FH Nürnberg » Thu May 26, 2011 11:33 am
Hallo Sandra,
thank you for the workaround, it works the memory is still the same after 10 min
Thank you
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Fri May 27, 2011 8:15 am
Hello FH Nürnberg,
I am glad that the solution works for you and solve your problem.
Thanks,