I'm curious as to when garbage collection happens in javascript (specifically on node.js).
(async() => {
let data = await getBigBlobFile()
const name = data.name
data = null //is this necessary?
longAsyncFunction(name, (err, res) => {
if (err) throw err
return res
})
})()
In this pseudo-code, is it necessary to manually set null on data?
I'm not sure if GC happens when the reference is out of block or is it enough for the compiler that 'data' is not used again until the end of the block? I need it to be released while the async function is running.
I've seen comments saying modern engines do this automatically but I can't seem to find anything to back this up.