All:
I am just start learning JS memory leaking, if I write a node module like(what I want to do is making blocking ajax call one after one in order, and eventually fill that bigtable):
var axios = require("axios")
var bigtable = []
var somedataURL = "some data URL here"
function buildReq(dataURL){
return axios.get(dataURL)
.then(function(response) {
// response.data is just a simple array
var data = response.data.slice(0);
bigtable = bigtable.concat(data);
return bigtable;
})
}
var req = buildURL(somedataURL);
for(var i = 0; i<10; i++){
req = req.then(function(bigtable){
return buildReq(somedataURL_IdontCARE);
})
}
req.then(function(bigtable){
console.log("final:"+bigtable)
})
module.exports = bigtable
For this specific example, could anyone help to point out if there is memory leak? Why?
Thanks