i have been getting javascript heap out of memory error
while running webpack command to build my project
i have tried to put 4GB memory allocation to node for executing webpack
this is the configuration to run the webpack command
package.json
"scripts": {
"build:prod": "node --max-old-space-size=4096 webpack -p --config webpack/webpack.config.prod.js"
}
i am executing npm run build:prod
and when i print the allocated memory
{ total_heap_size: 6537216,
total_heap_size_executable: 1048576,
total_physical_size: 5222208,
total_available_size: 1520740616,
used_heap_size: 4015776,
heap_size_limit: 1526909922,
malloced_memory: 8192,
peak_malloced_memory: 421336,
does_zap_garbage: 0 }
it still shows 1.5GB
what am i doing wrong here, i am using below code to print above stats
const v8 = require('v8');
const heapStats = v8.getHeapStatistics();
console.log(heapStats);