SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components



I have an application where I can potentially create, plot and export (as png) hundreds of graphs. It all runs smoothly but the “ExportToFile” method of the SciChartSurface. It seems to never de-allocate the memory it uses even after disposing the SciChartSurface itself. After a few hundred graphs, the application ends up using 70Gb+ of ram but if I just comment out the ExportToFile line, the application never uses more than 2Gb of ram (as expected).

I’ve tried putting:
…both after the ExportToFile and after disposing the graphs, but it makes no difference.

Has anyone experienced this issue? Is there anything else that I can try?


  • You must to post comments


I’m still completely blocked by this. It seems like the problem is a memory lead in the BitmapEncoder library, but I can’t work my way around it since SciChart can only return a BitmapSource.

You can see in the attached image that the “Unmanaged Memory” heap grows for each graph image that I save/export and that can never be claimed back….

Using the code: (MainChart is an instance of a SciChartSurface)

using (var fileStream = new FileStream(imgName, FileMode.Create))
    var encoder = new PngBitmapEncoder();

..leaks just as much memory as using the:

MainChart.ExportToFile(imgName, expType, false);

Using FreeImage to save the file makes no difference because I still depend on the BitmapEncoder to convert the BitmapSource into a Bitmap:

 using (var outStream = new MemoryStream())
            BitmapEncoder enc = new BmpBitmapEncoder();
            using (var bitmap = new Bitmap(outStream))
                FreeImage.SaveBitmap(bitmap, imgName, FREE_IMAGE_FORMAT.FIF_PNG, FR

Does anyone have any ideas on how I can circumvent this leak?

  • Andrew
    Hi Daniel, you mention you are using v4.0 of SciChart. Does the same issue occur in the latest release v4.2.4? Best regards, Andrew
  • Daniel Reidler
    Hey, thanks for the reply.I think I’m using 4.2.2, but I’m not sure where to check it.
  • Daniel Reidler
    As far as I understood it, the leak is in the BitmapEncoder.Save() method. I found a post somewhere saying that this is a known issue by Microsoft but according to them it only happens while debugging the application. This is not the case for me, I get the same behavior when running it too.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.