VinnieP79 Posted January 15, 2009 Report Share Posted January 15, 2009 I'm looking into some memory issues with our app, and it looks like the ChartFX for WPF chart is potentially one of the heavier items. I created a new WPF project and added the following code to Window1.cs: using System;using System.Diagnostics;using System.Windows;using System.Windows.Threading;using ChartFX.WPF;namespace TestSolution1{ /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { private DispatcherTimer _timer; private long _tickCount; public Window1() { InitializeComponent(); _timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(100)}; _timer.Tick += new EventHandler(_timer_Tick); this.Loaded += new RoutedEventHandler(Window1_Loaded); } void _timer_Tick(object sender, EventArgs e) { _tickCount++; Chart chart = this.Content as Chart; if (chart != null) { this.Content = null; } else { chart = new Chart(); this.Content = chart; } if(_tickCount % 100 == 0) Trace.WriteLine(_tickCount); //if (_tickCount % 1000 == 0) // GC.Collect(); } void Window1_Loaded(object sender, RoutedEventArgs e) { _timer.Start(); } }} If you run this, you'll see a flickering chart and that the memory allocation continues to increase with periodic but minor Garbage Collections. (See attached image) If you comment out the line where the Chart is being added as content, the memory profile stays flat. So I'm guessing that something special is happening when the chart is actually being displayed - whether it be by WPF or within the Chart itself. What can we do to reclaim all that memory? We hit the 2 GB limit before we can generate 80 charts because things aren't going away. Thanks! Quote Link to comment Share on other sites More sharing options...
JuanC Posted January 15, 2009 Report Share Posted January 15, 2009 Can you post the version of ChartFX.WPF.dll that you are using? We just tested the same code against our more recent build and the memory consumption seems stable, you might want to contact us (wpf at softwarefx dot com) to request an updated installer. JuanC Quote Link to comment Share on other sites More sharing options...
VinnieP79 Posted January 27, 2009 Author Report Share Posted January 27, 2009 Looks like I forgot to post a conclusion to this, but the RC1 DLL does not exhibit this behavior. Good job! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.