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



I have found out that calling suspendUpdate() and resumeUpdate() on a SciChartSurface object allocates memory that is never released. The allocations get bigger with more data in the chart.

I have created an empty Android project. I have added a SciChartSurface and a Button. Pressing the button suspends and resumes updates. You can then see in the Android Monitor that after each press of the button the memory consumption of the app increases. Since the chart is empty the allocations are very small but still noticeable. I have attached the zip of the example project.

Kotlin code of the Activity in the project:

class MainActivity : AppCompatActivity()
    override fun onCreate(savedInstanceState: Bundle?)

        val layout = findViewById( as ConstraintLayout

        val chartSurface = SciChartSurface(this)

        val button = findViewById( as Button
        button.setOnClickListener {
            val suspender = chartSurface.suspendUpdates()


I have tried to open a priority ticket, but I got the following error:

We encountered a problem (cross-site request forgery detected); please try again
Sorry, we encountered a problem (invalid department). Please start over.

  • You must to post comments

Hi Miha,

I believe this happens because of incorrect using of UpdateSuspender API. To prevent memory leaking you need to call dispose() or close() method on suspender instance:

val suspender = chartSurface.suspendUpdates()

Also UpdateSuspender implements AutoClosable interface which allows you to use try-with-resources statement and ensures that suspender will be disposed and there will be no memory leaks. Also you can use helper method provided by UpdateSuspender class which we use in our examples ( it uses try-with-resources under the hood ):

UpdateSuspender.using(surface, {
    // do something while surface is suspended

Hope this will help you!

Best regards,

  • MIha Rozina
    Ah I have missed that. Thank you for your help!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.