Description
Refs: #26878
I am working on a flag --heap-prof
here similar to --cpu-prof
and would like to see the general feeling about this flag. It's pretty similar to --cpu-prof
, and reuses most of the CPU profiler and coverage integration (with an abstract class).
$ ./node --heap-prof -p process.versions
$ ls *.heapprofile
Heap.20190426.140439.43866.0.001.heapprofile
When opening the profile in the Chrome DevTools it looks like this:
(to my surprise makeNodeErrorWithCode
allocates quite an amount of memory during startup)
There is still a remaining issue with the current implementation (and it's also the case for --cpu-prof
but reproduce less often): the default sampling interval is too high which makes the test quite flaky - but we can't allocate too much memory in the test in case it times out in the CI on the less powerful machines. It would be pretty simple to add --cpu-prof-interval
/--heap-prof-interval
and make them customizable, but I am not sure if people are comfortable with this kind of API design (passing everything with flags, though that's already the case for --report-*
)