node.js - nodejs performance optimization issues
阿神
阿神 2017-05-31 10:41:22
0
1
612
//定时任务
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?

阿神
阿神

闭关修行中......

reply all(1)
洪涛

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template