Memory Leak when load() API is called
See original GitHub issueI 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 I
m 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:
- Created 7 years ago
- Reactions:6
- Comments:7
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 theunload
option inc3.load()
or thec3.unload()
.Ditto