mirror of https://github.com/nodejs/node.git
Add V8 heap info to process.memoryUsage()
parent
8a58e83870
commit
38e425d9bf
13
doc/api.txt
13
doc/api.txt
|
@ -110,7 +110,18 @@ The PID of the process.
|
|||
What platform you're running on. +"linux2"+, +"darwin"+, etc.
|
||||
|
||||
+process.memoryUsage()+ ::
|
||||
Returns the memory usage of the Node process: e.g. +{"rss":5828608,"vsize":3112529920}+
|
||||
Returns the memory usage of the Node process. It looks like this
|
||||
+
|
||||
----------------------
|
||||
{
|
||||
"rss": 4935680,
|
||||
"vsize": 41893888,
|
||||
"heapTotal": 1826816,
|
||||
"heapUsed": 650472
|
||||
}
|
||||
----------------------
|
||||
+
|
||||
+heapTotal+ and +heapUsed+ refer to V8's memory usage.
|
||||
|
||||
+process.exit(code=0)+::
|
||||
Ends the process with the specified code. By default it exits with the
|
||||
|
|
|
@ -513,6 +513,14 @@ v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
|
|||
info->Set(String::NewSymbol("rss"), Integer::NewFromUnsigned(rss));
|
||||
info->Set(String::NewSymbol("vsize"), Integer::NewFromUnsigned(vsize));
|
||||
|
||||
// V8 memory usage
|
||||
HeapStatistics v8_heap_stats;
|
||||
V8::GetHeapStatistics(&v8_heap_stats);
|
||||
info->Set(String::NewSymbol("heapTotal"),
|
||||
Integer::NewFromUnsigned(v8_heap_stats.total_heap_size()));
|
||||
info->Set(String::NewSymbol("heapUsed"),
|
||||
Integer::NewFromUnsigned(v8_heap_stats.used_heap_size()));
|
||||
|
||||
return scope.Close(info);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue