Skip to content

Switch heap profiling to use lazy allocation profile method by default#281

Open
IlyasShabi wants to merge 1 commit intomainfrom
ishabi/use-map-allocation-profiler
Open

Switch heap profiling to use lazy allocation profile method by default#281
IlyasShabi wants to merge 1 commit intomainfrom
ishabi/use-map-allocation-profiler

Conversation

@IlyasShabi
Copy link

What does this PR do?:
Switch heap profiling to use mapAllocationProfile instead of the legacy getAllocationProfile, and remove the old code path.

Motivation:
PR #260 showed (via CI benchmarks) that mapAllocationProfile cuts memory usage by ~52% for a significant heap size. This change makes using mapAllocationProfile as the default for heap profiling.

How to test the change?:

  • Unit tests

@IlyasShabi IlyasShabi self-assigned this Feb 19, 2026
@IlyasShabi IlyasShabi added the semver-patch Bug or security fixes, mainly label Feb 19, 2026
@github-actions
Copy link

Overall package size

Self size: 1.83 MB
Deduped: 2.2 MB
No deduping: 2.2 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | source-map | 0.7.6 | 185.63 kB | 185.63 kB | | pprof-format | 2.2.1 | 163.06 kB | 163.06 kB | | p-limit | 3.1.0 | 7.75 kB | 13.78 kB | | node-gyp-build | 3.9.0 | 8.81 kB | 8.81 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@IlyasShabi IlyasShabi marked this pull request as ready for review February 19, 2026 15:37
@IlyasShabi IlyasShabi changed the title use MapAllocationProfile by default to get heap profiler Switch heap profiling to use lazy allocation profile method by default Feb 19, 2026
@IlyasShabi
Copy link
Author

@codex review

@DataDog DataDog deleted a comment from chatgpt-codex-connector bot Feb 19, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 889cf467f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

* Collecting a heap profile with V8 allocation profile format:
```javascript
const profile = await pprof.heap.v8Profile();
const profile = pprof.heap.v8Profile(root => root);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid returning raw allocation root from v8Profile example

This example returns root out of v8Profile (pprof.heap.v8Profile(root => root)), but the allocation nodes are only valid during the callback; after it returns, the native allocation profile backing those node views is freed, so later property access can hit dangling data. Users who copy this snippet to keep a V8 profile object can get undefined behavior/crashes; the sample should instead transform/copy inside the callback and return that copied structure.

Useful? React with 👍 / 👎.

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

Labels

semver-patch Bug or security fixes, mainly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments