Memory leak with data update

Author: tarikmsCreated Dec 10, 2015Updated Nov 16, 2022
Labelsbug

Hi,

I just implemented MG in a web application to test its performance in real time data display. It works fine at first, but over time the memory allocated in the client browser increases steadily to a point where the application just crashes. I'm wondering if there's a memory leak with MG, D3 or my code (the way I'm updating the chart).

Details: My line graphic has 12 series, with 1 point each per second. I update it every second by ajax calls to an API and then calling MG.data_graphic({...}) with the new data object. I found this approach suggested in the wiki and other closed issues. I'm storing the data in a javascript array and I limit the max number of points in each series to 300 by calling the shift function in the array. The graphic runs fine with this amount of points, but after some minutes I saw a google chrome process get up to 800mb of memory and it always crashes (the browser kills it).

So is there any mistake or better method to use this? Or is it just not feasible for this use case?

Regards, Tárik

Source: metricsgraphics/metrics-graphics