基于内存的自动重启进程

Value passed is in megaoctets. Internally it uses the V8 flag --max-old-space-size=MEM to make a process exit when memory exceed a certain amount of RAM used.

CLI:

$ pm2 start big-array.js --max-memory-restart 20M

JSON:

{
  "name" : "max_mem",
  "script" : "big-array.js",
  "max_memory_restart" : "20M"
}

Units can be K(ilobyte), M(egabyte), G(igabyte).