René's URL Explorer Experiment


Title: POC: Memory profiler allocation labels by rudolf · Pull Request #62649 · nodejs/node · GitHub

Open Graph Title: POC: Memory profiler allocation labels by rudolf · Pull Request #62649 · nodejs/node

X Title: POC: Memory profiler allocation labels by rudolf · Pull Request #62649 · nodejs/node

Description: This is a POC for initial feedback. If we can get alignment within Node.js I could try to contribute the v8 changes upstream. Summary Adds the ability to tag sampling heap profiler allocations with string labels that propagate through async context (via CPED). This enables attributing memory usage to specific HTTP routes, tenants, or operations — something no JS runtime currently supports. V8 changes HeapProfileSampleLabelsCallback — embedder callback invoked on sampled allocations to retrieve labels from the current async context AllocationProfile::Sample::labels — key-value pairs on each sample (behind V8_HEAP_PROFILER_SAMPLE_LABELS compile flag) Datadog's Attila Szegedi proposed a similar label mechanism for CPU profiling on v8-dev (July 2025). V8 team (Leszek Swirski) indicated they would review non-invasive patches behind #ifdefs. This PR applies the same approach to heap profiling, which is simpler. Everything runs on the allocation thread with no signal-safety concerns. Node.js changes: v8.withHeapProfileLabels(labels, fn) — runs fn with labels that propagate across await v8.setHeapProfileLabels(labels) — sets labels for current async scope (for framework middleware patterns) v8.getAllocationProfile() returns samples[].labels and per-label externalBytes (Buffer/ArrayBuffer) ProfilingArrayBufferAllocator tracks external allocations per label (single atomic load overhead when disabled) #62273 landed the SyncHeapProfileHandle API with Symbol.dispose support. The labels API proposed here is complementary, it adds context (which route/tenant) to the samples that SyncHeapProfileHandle already collects. A follow-up could integrate withHeapProfileLabels as a method on the handle. Motivation In multi-tenant or multi-route Node.js servers, a memory spike today tells you how much memory grew but not what caused it. Operators resort to code inspection or heap snapshots but these don't scale to collecting data over long timespans for large deployments. With labeled heap/external memory profiling, you can answer "route /api/search accounts for 400MB of the 1.2GB heap" directly from production telemetry (e.g. via OTel). This mirrors Go's pprof.Labels capability Overhead 20-run benchmark (two-server realistic HTTP workload): Sampling profiler alone: 0.6% (not statistically significant) Sampling + labels: 2.2% total (p<0.01) When disabled: zero overhead (no code path changes) Test plan V8 cctests for label callback JS tests: label propagation across await, concurrent contexts, setHeapProfileLabels, external memory tracking, GC cleanup Micro and macro benchmarks in benchmark/v8/ and benchmark/http/

Open Graph Description: This is a POC for initial feedback. If we can get alignment within Node.js I could try to contribute the v8 changes upstream. Summary Adds the ability to tag sampling heap profiler allocations with...

X Description: This is a POC for initial feedback. If we can get alignment within Node.js I could try to contribute the v8 changes upstream. Summary Adds the ability to tag sampling heap profiler allocations with...

Opengraph URL: https://github.com/nodejs/node/pull/62649

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/commits/:range(.:format)
route-controllerpull_requests
route-actioncommits
fetch-noncev2:8b2721d5-d625-bb16-423e-4b542210b82f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDA42:241082:27DD69A:3573D93:6A655789
html-safe-noncebd6f7dcede3bfb98b622ea7803919fb0b872ef11899519eda54a2159bd22aaeb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTQyOjI0MTA4MjoyN0RENjlBOjM1NzNEOTM6NkE2NTU3ODkiLCJ2aXNpdG9yX2lkIjoiNDAwODk1NTQwOTY4MDY1MjE2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac601ba41d5c8a009b1d4ca7a1b849e4c8065e608d29628b5c15822d97bc2a5429
hovercard-subject-tagpull_request:3509425781
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/commits
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
twitter:imagehttps://avatars.githubusercontent.com/u/1281646?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1281646?s=400&v=4
og:image:altThis is a POC for initial feedback. If we can get alignment within Node.js I could try to contribute the v8 changes upstream. Summary Adds the ability to tag sampling heap profiler allocations with...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None52c76df668885aaff23b50bdca1fa1ea44ac9c1553e888ebc70ff1e4daa4625b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release309153364422b3c499922d1a2a6404910a58ed8e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F62649%2Fcommits%2F3e447511df1f8749dddacf1de8d1151ddfa16f31
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F62649%2Fcommits%2F3e447511df1f8749dddacf1de8d1151ddfa16f31
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Fcommits&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
Reloadhttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
Reloadhttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
Please reload this pagehttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36.1k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.3k https://github.com/nodejs/node/issues
Pull requests 1.1k https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
rudolfhttps://github.com/rudolf
nodejs:mainhttps://github.com/nodejs/node/tree/main
rudolf:poc-allocation-profiler-tags-v2https://github.com/rudolf/node/tree/poc-allocation-profiler-tags-v2
Conversation 19 https://github.com/nodejs/node/pull/62649
Commits 13 https://github.com/nodejs/node/pull/62649/commits
Checks 0 https://github.com/nodejs/node/pull/62649/checks
Files changed https://github.com/nodejs/node/pull/62649/files
Please reload this pagehttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
POC: Memory profiler allocation labels https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#top
Show all changes 13 commits https://github.com/nodejs/node/pull/62649/files
2febdb4 deps: add heap profile sample labels to V8 profiler rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/2febdb40d6c8c250115649e359d972b34f399eda
a393276 src: add heap profile labels bindings rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/a393276ad934e1bfc79683b1bb4e88c4ddf5d63a
a8ac88e lib: add heap profile labels API to v8 module rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/a8ac88ee7a4293a44a7efa56dd71df2e33656392
c1934a5 test: add heap profile labels tests rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/c1934a563c98b7114b1f5f4a031d80cf8708491e
0e7004b doc: add heap profiler labels API documentation rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/0e7004b0720f7c2dfaaeea37cd42cda4b08bfebf
18a6b90 benchmark: add heap profiler labels overhead benchmarks rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/18a6b9093cd1cc6573de2aeee95d7eef1b089749
37180c7 deps: add LookupAlsValue to V8 heap profiler rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/37180c76d8d244d47f49c37892c8743f02bae9d0
3e44751 src: add ProfilingArrayBufferAllocator for external memory tracking rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
d5fa37d test: add external memory tracking tests rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/d5fa37d00e6f2dc16cff7a24d25298d3ec8bd0a7
da6af28 doc: add externalBytes to heap profiler documentation rudolf Apr 15, 2026 https://github.com/nodejs/node/pull/62649/commits/da6af2885d48a5ab1d59f4d3ecc52824f332d462
b24f8d9 benchmark: add getAllocationProfile label resolution benchmark rudolf Apr 21, 2026 https://github.com/nodejs/node/pull/62649/commits/b24f8d9d7cb907715e7d01b5dc6a29e32fc476eb
6fb8f12 src: fix heap profile labels init order and build rudolf Apr 21, 2026 https://github.com/nodejs/node/pull/62649/commits/6fb8f121b3bbcbc18a2cff8a1c3d426dab5cae5c
a6391ec deps: cache label resolution in GetAllocationProfile rudolf Apr 21, 2026 https://github.com/nodejs/node/pull/62649/commits/a6391ec1e2bb226c3a585e1b5deb52f179ccad6f
Clear filters https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
Please reload this pagehttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
Please reload this pagehttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
environment.cc https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
node_internals.h https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-6648b37276e20be36473a32445be879f73cedc8d557c06a8a8dfc9adb013a42d
node_v8.cc https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-b31178bc5d9c07672e946e9dc0b52d163fa8e24220f6f4d2157eac2578c7041b
Prev https://github.com/nodejs/node/pull/62649/commits/37180c76d8d244d47f49c37892c8743f02bae9d0
Next https://github.com/nodejs/node/pull/62649/commits/d5fa37d00e6f2dc16cff7a24d25298d3ec8bd0a7
Please reload this pagehttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
https://github.com/rudolf
rudolfhttps://github.com/nodejs/node/commits?author=rudolf
src/api/environment.cchttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
View file https://github.com/nodejs/node/blob/3e447511df1f8749dddacf1de8d1151ddfa16f31/src/api/environment.cc
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/62649/commits/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-5f2fc380364ef43210af4a28c08f9a0c7ec5f85e3ec1f5c1df5e0204eb9dc721
src/node_internals.hhttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-6648b37276e20be36473a32445be879f73cedc8d557c06a8a8dfc9adb013a42d
View file https://github.com/nodejs/node/blob/3e447511df1f8749dddacf1de8d1151ddfa16f31/src/node_internals.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/62649/commits/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-6648b37276e20be36473a32445be879f73cedc8d557c06a8a8dfc9adb013a42d
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-6648b37276e20be36473a32445be879f73cedc8d557c06a8a8dfc9adb013a42d
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-6648b37276e20be36473a32445be879f73cedc8d557c06a8a8dfc9adb013a42d
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-6648b37276e20be36473a32445be879f73cedc8d557c06a8a8dfc9adb013a42d
https://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31#diff-6648b37276e20be36473a32445be879f73cedc8d557c06a8a8dfc9adb013a42d
Please reload this pagehttps://github.com/nodejs/node/pull/62649/commits/3e447511df1f8749dddacf1de8d1151ddfa16f31
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.