Pre loader

Memory problem

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
1
0

I have a big problem with memory, i try many things but it’s doesn’t effect.
It’s my code for testing memory :

    const { wasmContext, sciChartSurface } = await SciChartSurface.create("bandTest", { theme: new SciChartJSLightTheme() });
    sciChartSurface.title = "Axis 1";
    sciChartSurface.xAxes.add(new NumericAxis(wasmContext, { axisTitle: "Column number", axisTitleStyle: {fontSize: 12} }));
    sciChartSurface.yAxes.add(new NumericAxis(wasmContext, { axisAlignment: EAxisAlignment.Left, axisTitleStyle: {fontSize: 12} }));
    setTimeout(sciChartSurface.delete(),2000);

sciChartSurface.delete() have no effect for memory
I run snapshot without this code and another snapshot with this code. (snap 14 is before call SciChart and snap 15 is after call the code bellow)

What can I do?

Regards

Version
3.1.348
Images
  • You must to post comments
Best Answer
0
0

Good morning Margorie,

SciChart.js v3.2 has been released this week, which fixes a memory leak in Webassembly and improves memory management throughout.

Some content which is particularly applicable to memory use includes:

  1. Memory Best Practices documentation
  2. Memory Leak Debugging
  3. Best practice tutorial – creating a re-usable React Component with delete / proper lifecycle
  4. Our new Getting-Started page also has some best-practice for component lifecycle to delete charts on unmount.

Best regards,
Andrew

  • You must to post comments
Good Answer
0
1

Hi Marjorie,

Memory is being released when you call SciChartSurface.delete() but back to WebAssembly not to the browser. Also, we are caching our graphics engine so the next Chart startup time is faster. If you instantiate a second chart and delete it memory won’t grow. It will stay the same.

You’re going to be really happy to know we’ve made a massive improvement to memory in v3.2 of SciChart.js which is in beta now.

You can try the beta from npm.

Try the code above in 3.2.0-beta but with this:

SciChartSurface.createSingle();

Instead of this

SciChartSurface.create(); 

And you will see as soon as the chart is deleted and garbage collected by javascript memory returns to the browser. Snapshot memory should go down.

There will also be a way in v3.2 to collect all memory using SciChartSurface.create() by setting some flags to destroy the WebGL buffers and engine.

We’ll be announcing more details on memory improvements very soon.

Best regards
Andrew

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.