Now I am using node.js in paas platform. And the container has memory limit. Now I want to get the maximum of the heap size of node.js application. I know that use the parameter "--max-old-space-size", I can set the max heap size, but I want to know how to get the default value of "--max-old-space-size". For example, if the container's memory is 512m , so the maximum of node.js heap size can not be greater than it. How can I get the value?
The default maximum Java heap size is 256 MB.
Currently, by default V8 has a memory limit of 512mb on 32-bit systems, and 1gb on 64-bit systems. The limit can be raised by setting --max-old-space-size to a maximum of ~1gb (32-bit) and ~1.7gb (64-bit), but it is recommended that you split your single process into several workers if you are hitting memory limits.
You can try the v8
module, it is documented here: https://nodejs.org/api/v8.html
I believe getHeapStatistics()
function will give you everything you need
you can use the process.memoryUsage
https://nodejs.org/api/process.html#process_process_memoryusage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With