//定时任务
setInterval(function() {
startCron();
}, 1000*20);
function startCron(){
let cron = new Cron();
cron.startCron();
}
For example, if cron is executed regularly, when will the memory of cron be released? If a certain attribute of cron is a larger array. For example, cron.data, do I need to manually set cron.data = [] to release memory every time cron ends the task?
If I don’t release it manually, will cron never release it?
I have recently encountered performance problems. Are there any good tools for nodejs to detect them?
No need to release it manually, it should be released automatically after startCron is run. The execution context where startCron is located will be released after it is executed. If you want to test performance, there seem to be quite a few. You can check it out on cnode. There seems to be an easy module written by Chinese people. You can use process.memory to test first