There are 3 types of GC events in V8
kGCTypeMarkSweepCompactkGCTypeScavengekGCTypeAll
V8 fires the scavenge event quite often, but only on newly created objects. Under heavy load, other types of GC may occur infrequently.
You can try running the NodeFly agent, which uses nodefly-gcinfo to track current memory usage.
You can also directly call nodefly-gcinfo , which has a callback that fires every time a GC event occurs:
require('nodefly-gcinfo').onGC(function(usage, type, flags){ console.log("GC Event Occurred"); console.log("Heap After GC:",usage, type, flags); });
Jacob Groundwater
source share