what is heap memory in javascript code example
Example 1: javascript heap out of memory
export NODE_OPTIONS=--max_old_space_size=4096
Example 2: process memory usage javascript
const arr = [1, 2, 3, 4, 5, 6, 9, 7, 8, 9, 10];
arr.reverse();
const used = process.memoryUsage().heapUsed / 1024 / 1024;
console.log(`The script uses approximately ${Math.round(used * 100) / 100} MB`);
Example 3: javascript heap out of memory
variable name = NODE_OPTIONS
variable value = --max-old-space-size=4096