Hi –
I could not find an example in the various examples your provide
I have several charts in different components
When a component is closed I want to ensure the chart is destroyed and there is not potential for memory leak
What is this best way of doing this?
Thanks
- Himura Kenshin asked 3 weeks ago
- You must login to post comments
Hi Himura
We have a blog post on this recently published: Debugging JavaScript and WebAssembly Memory Leaks using the SciChart.js debug tools
And this links to our documentation pages on Memory Best Practices.
In short, to delete a chart:
- once you are finished with a chart, call
sciChartSurface.delete();
- delete or remove the
<div/>
which the SciChartSurface was hosted in - ensure all references to
sciChartSurface
and itswasmContext
are detached (aka don’t keep them in global variables)
This will ensure proper cleanup of memory.
Depending on what framework you’re using: React, Angular, Vue or vanilla JS, there may be different ways to achieve this in practice.
For React we have a guide here on creating a Reusable React Component which automatically cleans up memory. We are also in the process of publishing an open source scichart-react npm package which will do all this for you. Other frameworks (Vue, Angular) may follow depending on user demand.
Let me know if this helps!
Best regards
Andrew
- Andrew Burnett-Thompson answered 3 weeks ago
- You must login to post comments
Please login first to submit.