René's URL Explorer Experiment


Title: Node-API addons with normal finalizers keep GBs of dead external memory on V8 >= 14.8 (v8-canary) · Issue #66859 · nodejs/node · GitHub

Open Graph Title: Node-API addons with normal finalizers keep GBs of dead external memory on V8 >= 14.8 (v8-canary) · Issue #66859 · nodejs/node

X Title: Node-API addons with normal finalizers keep GBs of dead external memory on V8 >= 14.8 (v8-canary) · Issue #66859 · nodejs/node

Description: Version v27.0.0-v8-canary2026101812b4708d0e (V8 15.8.21). Not reproducible on v26.12.0 (V8 14.6.202.34). Platform Darwin 24.6.0 arm64 (macOS) Subsystem node-api (root cause in V8 heap) What steps will reproduce the bug? This is a Node-AP...

Open Graph Description: Version v27.0.0-v8-canary2026101812b4708d0e (V8 15.8.21). Not reproducible on v26.12.0 (V8 14.6.202.34). Platform Darwin 24.6.0 arm64 (macOS) Subsystem node-api (root cause in V8 heap) What steps w...

X Description: Version v27.0.0-v8-canary2026101812b4708d0e (V8 15.8.21). Not reproducible on v26.12.0 (V8 14.6.202.34). Platform Darwin 24.6.0 arm64 (macOS) Subsystem node-api (root cause in V8 heap) What steps w...

Opengraph URL: https://github.com/nodejs/node/issues/66859

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Node-API addons with normal finalizers keep GBs of dead external memory on V8 >= 14.8 (v8-canary)","articleBody":"### Version\n\nv27.0.0-v8-canary2026101812b4708d0e (V8 15.8.21). Not reproducible on v26.12.0 (V8 14.6.202.34).\n\n### Platform\n\n```text\nDarwin 24.6.0 arm64 (macOS)\n```\n\n### Subsystem\n\nnode-api (root cause in V8 heap)\n\n### What steps will reproduce the bug?\n\nThis is a Node-API addon that wraps 1 MiB of native memory per object, reports it with `napi_adjust_external_memory`, and releases it in a normal (non-basic) `napi_wrap` finalizer. The script drops every object immediately and yields to the event loop every 100 allocations.\n\n`addon.c`:\n\n```c\n#include \u003cnode_api.h>\n#include \u003cstdlib.h>\n\n#define SIZE (1 \u003c\u003c 20)\nstatic int64_t live = 0;\n\nstatic void finalize(napi_env env, void* data, void* hint) {\n  int64_t ignored;\n  free(data);\n  live--;\n  napi_adjust_external_memory(env, -SIZE, &ignored);\n}\n\nstatic napi_value Make(napi_env env, napi_callback_info info) {\n  napi_value obj;\n  int64_t ignored;\n  void* mem = malloc(SIZE);\n  live++;\n  napi_create_object(env, &obj);\n  napi_adjust_external_memory(env, SIZE, &ignored);\n  napi_wrap(env, obj, mem, finalize, NULL, NULL);\n  return obj;\n}\n\nstatic napi_value Live(napi_env env, napi_callback_info info) {\n  napi_value result;\n  napi_create_int64(env, live, &result);\n  return result;\n}\n\nstatic napi_value Init(napi_env env, napi_value exports) {\n  napi_value fn;\n  napi_create_function(env, \"make\", NAPI_AUTO_LENGTH, Make, NULL, &fn);\n  napi_set_named_property(env, exports, \"make\", fn);\n  napi_create_function(env, \"live\", NAPI_AUTO_LENGTH, Live, NULL, &fn);\n  napi_set_named_property(env, exports, \"live\", fn);\n  return exports;\n}\n\nNAPI_MODULE(NODE_GYP_MODULE_NAME, Init)\n```\n\n`binding.gyp`:\n\n```json\n{ \"targets\": [ { \"target_name\": \"addon\", \"sources\": [\"addon.c\"] } ] }\n```\n\n`run.js`:\n\n```js\nconst { make, live } = require(\"./build/Release/addon.node\");\n(async () => {\n  let peak = 0;\n  for (let i = 0; i \u003c 20000; i++) {\n    make();\n    if (i % 100 === 99) {\n      peak = Math.max(peak, live());\n      await new Promise((r) => setImmediate(r));\n    }\n  }\n  console.log(`${process.version} (V8 ${process.versions.v8}): peak live = ${peak} MiB`);\n})();\n```\n\n```sh\nnpx node-gyp rebuild --nodedir=/path/to/node\nnode run.js\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways on the v8-canary build. The condition is that native memory reported with `napi_adjust_external_memory` is released from a normal finalizer, i.e. after the GC that found the object dead.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe amount of dead native memory waiting for collection should stay bounded, as it does on v26.12.0:\n\n```text\nv26.12.0 (V8 14.6.202.34-node.39): peak live = 136 MiB\n```\n\n### What do you see instead?\n\n```text\nv27.0.0-v8-canary2026101812b4708d0e (V8 15.8.21-node.7): peak live = 5660 MiB\n```\n\nGCs back off geometrically. `--trace-gc --trace-gc-verbose --trace-gc-nvp` shows the global allocation limit tracking the garbage, at 64, 117, 204, 272, 461, … MB.\n\nUsing a basic finalizer (`NAPI_EXPERIMENTAL`, which Node calls from the first-pass weak callback) keeps the peak at about 1 MB.\n\n### Additional information\n\nThe root cause is in V8, filed as https://issues.chromium.org/issues/574627777, which includes a stock-V8-API repro.\n\nSince V8 14.8 (6a5039d9db9, `external_memory_accounted_in_global_limit` on by default), V8 computes the global allocation limit inside the GC pause from external memory that still includes the objects that GC just found dead. Memory released after the pause never lowers that limit. That covers second-pass callbacks and the normal Node-API finalizers queued by `napi_env__::InvokeFinalizerFromGC`.\n\nNormal finalizers are the Node-API default, so native addons that hold large buffers will be affected once Node ships a V8 with this scheme. On v26 the same behavior can be previewed with `--external-memory-accounted-in-global-limit`. 14.6's implementation of that flag differs, though, so the canary is the faithful repro.\n\nThe scheme is also discussed in #61967 as the expected fix for the Buffer regression there.\n","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2026-10-19T17:49:09Z","url":"https://github.com/nodejs/node/issues/66859"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8b20ff01-63f3-3cf3-12be-8bea1849d23c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB412:F5278:AF9538:E891D8:6AED34EC
html-safe-nonce8431b41b4a9136b32dac02b66ed0b96185143a2228b2121af095785936e8a70b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDEyOkY1Mjc4OkFGOTUzODpFODkxRDg6NkFFRDM0RUMiLCJ2aXNpdG9yX2lkIjoiNjExMTIzNDI4NjM4MDk4NzYyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0a4831915749276bf83543c677a3ede23de23b93bac0d33c855ae550213469d8
hovercard-subject-tagissue:5928746473
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/66859/issue_layout
twitter:imagehttps://opengraph.githubassets.com/46012aa6bc1ebdec46562a54c28f8d7ab6a25e2c189314374b3061c312d65bc2/nodejs/node/issues/66859
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/46012aa6bc1ebdec46562a54c28f8d7ab6a25e2c189314374b3061c312d65bc2/nodejs/node/issues/66859
og:image:altVersion v27.0.0-v8-canary2026101812b4708d0e (V8 15.8.21). Not reproducible on v26.12.0 (V8 14.6.202.34). Platform Darwin 24.6.0 arm64 (macOS) Subsystem node-api (root cause in V8 heap) What steps w...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameedusperoni
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/66859#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F66859
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F66859
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/66859
Reloadhttps://github.com/nodejs/node/issues/66859
Reloadhttps://github.com/nodejs/node/issues/66859
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests665 (665)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66859
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66859
Node-API addons with normal finalizers keep GBs of dead external memory on V8 >= 14.8 (v8-canary)https://github.com/nodejs/node/issues/66859#top
https://github.com/edusperoni
edusperonihttps://github.com/edusperoni
on Oct 19, 2026https://github.com/nodejs/node/issues/66859#issue-5928746473
https://issues.chromium.org/issues/574627777https://issues.chromium.org/issues/574627777
#61967https://github.com/nodejs/node/issues/61967
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/66859
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66859
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.