src: use HeapStatistics to get external memory

V8 is improving the way external memory is internally managed and how
it is reported.
External memory should now be retrieved using HeapStatistics.

Refs: https://github.com/v8/node/pull/80

PR-URL: https://github.com/nodejs/node/pull/22754
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Rodrigo Bruno
2018-08-07 15:18:50 +02:00
committed by Michaël Zasso
parent dca0300a86
commit a5604a73d8

View File

@@ -208,7 +208,7 @@ void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
fields[0] = rss;
fields[1] = v8_heap_stats.total_heap_size();
fields[2] = v8_heap_stats.used_heap_size();
fields[3] = isolate->AdjustAmountOfExternalAllocatedMemory(0);
fields[3] = v8_heap_stats.external_memory();
}
// Most of the time, it's best to use `console.error` to write