From 55080eac09ea9bf3254398dba62b917f70e5aa4d Mon Sep 17 00:00:00 2001 From: ishabi Date: Wed, 2 Sep 2026 11:41:26 +0200 Subject: [PATCH] src: expose size and count in heap profile output Signed-off-by: ishabi --- doc/api/v8.md | 10 ++++++++++ src/node_profiling.cc | 9 ++++++++- test/parallel/test-v8-heap-profile.js | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/doc/api/v8.md b/doc/api/v8.md index a4373d1ac72d..0993744aea49 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -1628,6 +1628,16 @@ added: v26.1.0 Stopping collecting the profile and return the profile data. +The returned string is JSON in the Chrome DevTools sampling heap profile +format, with a `head` call-tree and a `samples` array. On top of the DevTools +fields, the following are added: + +* Each node reports `selfCount`, the number of sampled objects allocated by the + node (`selfSize` is the existing total in bytes). +* Each sample reports `objectSize`, `objectCount`, and `isLive`. + +The DevTools `size` field stays `objectSize * objectCount` for compatibility. + ### `syncHeapProfileHandle[Symbol.dispose]()`