diff options
Diffstat (limited to 'lib/v8.js')
-rw-r--r-- | lib/v8.js | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -15,11 +15,9 @@ 'use strict'; const v8binding = process.binding('v8'); -const smalloc = require('internal/smalloc'); const heapStatisticsBuffer = - smalloc.alloc(v8binding.kHeapStatisticsBufferLength, - v8binding.kHeapStatisticsBufferType); + new Uint32Array(v8binding.heapStatisticsArrayBuffer); const kTotalHeapSizeIndex = v8binding.kTotalHeapSizeIndex; const kTotalHeapSizeExecutableIndex = v8binding.kTotalHeapSizeExecutableIndex; @@ -28,9 +26,9 @@ const kUsedHeapSizeIndex = v8binding.kUsedHeapSizeIndex; const kHeapSizeLimitIndex = v8binding.kHeapSizeLimitIndex; exports.getHeapStatistics = function() { - var buffer = heapStatisticsBuffer; + const buffer = heapStatisticsBuffer; - v8binding.getHeapStatistics(buffer); + v8binding.updateHeapStatisticsArrayBuffer(); return { 'total_heap_size': buffer[kTotalHeapSizeIndex], |