Fast scroll zoom results in out of memory error #7021
Copy link
Copy link
Closed
Labels
Description
See https://codepen.io/arnog/pen/YgZdEZ
- Create a heatmap plot with about 500 x 500 elements
- Configure the plot with
scrollZoom = trueandzsmooth = 'fast' - Use the mouse wheel to zoom in rapidly into the plot
Result:
- the plot is not zoomed in and the console displays "Uncaught RangeError: Invalid array length"
The array being created is the pixel array in which to draw the interpolated heatmap at traces/heatmap/plot.js:238
The problem seems to be that imageWidth and imageHeight are used here and later in the function, perhaps instead of canvasW and canvasH.
(refiled #3615 as per request)
I have seen this on Chrome on macOS. The error happens here:
if(zsmooth) { // best or fast, works fastest with imageData
var pxIndex = 0;
var pixels;
try {
pixels = new Uint8Array(imageWidth * imageHeight * 4);
} catch(e) {
pixels = new Array(imageWidth * imageHeight * 4);
}when executing the new Array in the catch statement. When it happens, imageWidth was 63775964 and imageHeight was 63442058.
Reactions are currently unavailable
Activity
emilykl commentedon Aug 27, 2026
Hi @arnog, apologies for the slow follow-up. I believe this issue was resolved by #6565 which changed the lines you mentioned, in the service of solving a different bug.
I tried your codepen with the latest plotly.js version (v4.0.0) and the issue seems resolved. Please let us know if that's not the case!
arnog commentedon Aug 27, 2026
Thanks for the follow up!