Pre loader

XyDataSeries.insertRange fails with "memory access out of bounds"

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


I have XyDataSeries with 50 data points and I’m trying to insert another 50 data points to index 5. The same values can be inserted as a range to the beginning of the data series or inserted one by one starting from index 5. But they fail with “RuntimeError: memory access out of bounds” whenever I try to insert them as a range from index 5.

Code snippet:

const { xValues, yValues } = generateData(50);
const dataSeries = new XyDataSeries(wasmContext, { xValues, yValues, isSorted: false });
sciChartSurface.renderableSeries.add(new FastLineRenderableSeries(wasmContext, { dataSeries }));

// this works
dataSeries.insertRange(0, xValues, yValues);
// this works
for (let i = 0; i < xValues.length; i++) {
  dataSeries.insert(i + 5, xValues[i], yValues[i]);
// this fails
dataSeries.insertRange(5, xValues, yValues);

Codesandbox link:

I wonder if I’m doing something wrong or if this is an actual issue?

Side note: Index 5 is just an example, because it seems I can use the insertRange method when inserting to index 0-2, but it fails when inserting to index 3+ (in case of a chart with 50 existing data points)

  • You must to post comments
Best Answer

Hi Timo,

Thank you for the bug report & info. The codesandbox is very useful. Top marks!

Good news, we’ve found & fixed an issue in the low-level memory buffers for XyDataSeries which was causing this memory access out of bounds error.

This has been pushed to our production branch and will be fixed in the next release (version > 3.0.284). Timescale: probably about a week or two at the most.

In the meantime, if you add this workaround:

  // before xyDataSeries.insertRange(index), reserve extra memory 
    .reserve(dataSeries.count() + index + xValues.length);
    .reserve(dataSeries.count() + index + yValues.length);

  // Now do the last insert
  dataSeries.insertRange(index, xValues, yValues);

This should work until the release. You want to remove that as soon as we publish!

Best regards,

  • You must to post comments

Hey Andrew,

That’s great! Thank you for fixing it and for letting me know about the workaround!


  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.