get the max heap size of a node.js application

时间:2015-10-29 15:54:09

标签: node.js heap-memory

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?

2 个答案:

答案 0 :(得分:10)

您可以尝试v8模块,此处记录在案:https://nodejs.org/api/v8.html

我相信getHeapStatistics()功能会为您提供所需的一切

答案 1 :(得分:0)