This question asks what the various values returned by v8.getHeapStatistics()
are, but I'm still not clear what the units are.
I would expect the units of those relating to memory/heap size to all be bytes.
However, I'm trying to debug an apparent memory leak in a NodeJS app, and am periodically writing out the used_heap_size
as a percentage of the total_available_size
to see how quickly the heap fills up, and I'm seeing some very odd output.
The heap apparently gets to just over 10,000% (yes, ten thousand percent) full before the app crashes with:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
So either I'm misunderstanding the relationship between used_heap_size
and total_available_size
, or else they don't have the same units. (Or there's conceivably a bug, I suppose.)
The docs say that they're both numbers, which is only helpful to a point.
Am I making an incorrect assumption? Am I misunderstanding the values?