When I run bluebird's promisify()
in setInterval()
, I found a memory leak problem. There is the issue https://github.com/petkaantonov/bluebird/issues/1663. I doubt it's because the "compiled code" of new Function()
can't be collected by gc of nodejs
. So I run the following test and record heap snapshot by Chrome DevTools. As time increases, there are more and more "compiled code" of new Function()
.
setInterval(() => {
const a = new Function('a', 'console.log(a)');
a('1');
}, 10);
I want to know why Node.js gc doesn't collect "complied code" of new Function()
and whether it is a a bug?