File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,18 @@ The PID of the process.
110
110
What platform you're running on. +"linux2"+, +"darwin"+, etc.
111
111
112
112
+process.memoryUsage()+ ::
113
- Returns the memory usage of the Node process: e.g. +{"rss":5828608,"vsize":3112529920}+
113
+ Returns the memory usage of the Node process. It looks like this
114
+ +
115
+ ----------------------
116
+ {
117
+ "rss": 4935680,
118
+ "vsize": 41893888,
119
+ "heapTotal": 1826816,
120
+ "heapUsed": 650472
121
+ }
122
+ ----------------------
123
+ +
124
+ +heapTotal+ and +heapUsed+ refer to V8's memory usage.
114
125
115
126
+process.exit(code=0)+::
116
127
Ends the process with the specified code. By default it exits with the
Original file line number Diff line number Diff line change @@ -513,6 +513,14 @@ v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
513
513
info->Set (String::NewSymbol (" rss" ), Integer::NewFromUnsigned (rss));
514
514
info->Set (String::NewSymbol (" vsize" ), Integer::NewFromUnsigned (vsize));
515
515
516
+ // V8 memory usage
517
+ HeapStatistics v8_heap_stats;
518
+ V8::GetHeapStatistics (&v8_heap_stats);
519
+ info->Set (String::NewSymbol (" heapTotal" ),
520
+ Integer::NewFromUnsigned (v8_heap_stats.total_heap_size ()));
521
+ info->Set (String::NewSymbol (" heapUsed" ),
522
+ Integer::NewFromUnsigned (v8_heap_stats.used_heap_size ()));
523
+
516
524
return scope.Close (info);
517
525
#endif
518
526
}
You can’t perform that action at this time.
0 commit comments