how to check how much memory a node app is using up code example
Example: how to understand if nodejs is out of memory
const used = process.memoryUsage().heapUsed / 1024 / 1024;
console.log(`The script uses approximately ${Math.round(used * 100) / 100} MB`);