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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.



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.
  • Florentin Vintila
    This is still a problem. We have an application based on Scichart that saves periodically (every 1 sec) images (aprox . 1MB) in png format. sciChartSurface.ExportToFile(filename, ExportType.Png, false, new Size(width, height)); After about 30 minutes we have an increased memory about 2GB. When the images are not saved there is no increase in memory. Did you find any solution for your memory leak?
  • Andrew
    Hi Florentin, we will need code to analyse this problem. If you can reproduce it and sent it to support as a bug report, our team can profile and investigate.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.