Skip to content

RFC: add a flag --heap-prof (similar to --cpu-prof but for the heap) #27421

Description

@joyeecheung

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:

Screen Shot 2019-04-26 at 2 05 35 PM

(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-*)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command-line interface.inspectorIssues and PRs related to the V8 inspector protocol.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions