Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如果通过';启动,PM2读取的内存不正确;npm启动';_Node.js_Pm2 - Fatal编程技术网

Node.js 如果通过';启动,PM2读取的内存不正确;npm启动';

Node.js 如果通过';启动,PM2读取的内存不正确;npm启动';,node.js,pm2,Node.js,Pm2,PM2版本0.36.0 NodeJS版本15.0.1 结构 pm2.config.js testpm2 ├── index.js └── package.json pm2.config.js module.exports ={ "apps": [ { "name": "my-test-app", "cwd": "./testpm2&q

PM2版本0.36.0 NodeJS版本15.0.1

结构

pm2.config.js
testpm2
├── index.js
└── package.json
pm2.config.js

module.exports ={
    "apps": [
        {
            "name": "my-test-app",
            "cwd": "./testpm2",
            "script": "npm",
            "args": "start"
        }
    ]
}
const arr = [];
setInterval(() => {
  for (let i = 0; i < 100000; i += 1) {
    arr.push('12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
  }
  console.log('running....', arr.length);
  console.log(process.memoryUsage());

}, 100);
index.js

module.exports ={
    "apps": [
        {
            "name": "my-test-app",
            "cwd": "./testpm2",
            "script": "npm",
            "args": "start"
        }
    ]
}
const arr = [];
setInterval(() => {
  for (let i = 0; i < 100000; i += 1) {
    arr.push('12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
  }
  console.log('running....', arr.length);
  console.log(process.memoryUsage());

}, 100);
当pm2运行时,pm2监视器显示内存恒定在49MB。显然是泄漏,但pm2未能读取正确的内存值。

我是否错误地配置了生态系统文件?这里发生了什么事