v8 API Deep Dive

Sampling Memory Allocations

  • aggregating all allocations that were sampled is a bit more complex but basically recursively walks the allocation stack
  • further aggregation is performed on JS side
auto children = node->children;
for (v8::AllocationProfile::Node* child : children) {
  WalkAllocationStack(
      recv,
      alloc_fn,
      function_fn,
      child,
      depth + 1);
}