question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory Leak when load() API is called

See original GitHub issue

I haven’t had a chance to look into the code of the load() API, but Im pretty sure there is a memory leak in somewhere. I created an application on Electron and Im using c3.js to draw sparkline charts. I called the load() API inside a timer and the application consumes more than 100 MB of RAM without any reasonable reason. If I comment out the load() API then the memory consumption is around 30 MB.

       var remove = false; 
       if(cpuSparkData[0].length>10){
            var remove = true;                
        }        
        
        for(var i = 0; i < data.cpus.length ; i++){
            var load = parseFloat(data.cpus[i].load).toFixed(0);
            console.log(cpuSparkData.length);
            cpuSparkData[i].push(load);
            if(remove){
                cpuSparkData[i].splice(1,1);
            }
        }

        
        /*cpuSparkChart.load({

            columns: cpuSparkData});

        });*/

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

3reactions
momocowcommented, Sep 13, 2018

Same here, the memory increases permanently when calling load in an interval.

Face with the same problem these days.

C3 seems to hold all the data loaded into it in the memory and associates them with IDs respectively.

FYI. Take a look at its reference, c3.data(), to realize that it has the behavior of data caching. Also take a look at the unload option in c3.load() or the c3.unload().

0reactions
cjbaileycommented, Jun 12, 2018

Ditto

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory Leak when load() API is called even with option ...
Same issue as #1961, I create 7 line-charts with timeseries x-axis, and each chart has 240 data points. Only on page load, it...
Read more >
memory leak when calling an Api - ios - Stack Overflow
No, loading 1000 elements from an API won't cause a memory leak. A memory leak is when you lose track of unused objects...
Read more >
Understanding Memory Leaks in Java - Baeldung
A Memory Leak is a situation where there are objects present in the heap that are no longer used, but the garbage collector...
Read more >
Avoid Memory Leaks in your React App by canceling API calls
The most easily overlooked cause for memory leaks would be improper handling of API calls.
Read more >
Hunting Java Memory Leaks - Toptal
A memory leak occurs when object references that are no longer needed are unnecessarily maintained. These leaks are bad. For one, they put...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found