I'm using pm2 and node js. What I want to do is set a maximum memory limit for an application. My dev server's limit is 500mb split between two applications. Ideally I would like to limit it to 200mb. I need this limit to be a hard limit for the application, and for it to not restart the application if it exceeds it like the pm2 command "max_memory_restart" does. I've also tried to use the --max_old_space_size command with no luck. Is there any way to do this?
Example pm2 json file
{
"apps": [
{
"name": "Sample",
"script": "runit.js",
"watch": false,
"cwd": "xxxxxx",
"env": {
"NODE_TLS_REJECT_UNAUTHORIZED": '0',
"NODE_ENV": "local_public",
"PORT": 3000,
"PROXY_PORT": 4000,
},
"args": [
"--max_old_space_size=200"
]
}
]
}
args
withnode_args
. – Curry