Jump to content
Software FX Community

Chart Memory Profile


VinnieP79

Recommended Posts

 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!

Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...