FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: implement GetDetachedness() in MemoryRetainerNode by joyeecheung · Pull Request #44803 · nodejs/node · GitHub

/ node Public

src: implement GetDetachedness() in MemoryRetainerNode - #44803

Closed
joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:detached-retainer
Closed

src: implement GetDetachedness() in MemoryRetainerNode#44803
joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:detached-retainer

Conversation

joyeecheung commented Sep 27, 2022
edited
Loading

Copy link
Copy Markdown
Member

This allows us to mark weak/detached references in the heap snapshot. Also mark weak/detached BaseObject with Detachedness::kDetached so that the state of the reference can be displayed by frontend consuming the heap snapshot.

With the following snippet:

const dns = require('dns');
dns.resolve('localhost', () => {
  setTimeout(write, 1000);
});

function write() {
  const v8 = require('v8');
  v8.writeHeapSnapshot();
}

The cleanup queue in the generated heap snapshot previously looked like this in the DevTools - nodes that will be GC'ed once they are no longer referenced from JS land are not distinguished from nodes that are kept alive from the C++ land.

Now it looks like this - nodes that will be GC'ed once they are no longer referenced from JS have the Detached label (note that in the case of ChannelWrap, if we take the snapshot before the query completes, the ChannelWrap won't be marked as Detached, because it would still be reachable from the QueryWrap which is kept alive by C++ i.e. being attached - objects reachable from attached objects are also considered attached by DevTools):

This allows us to mark weak/detached references in the heap snapshot.
Also mark weak/detached BaseObject with Detachedness::kDetached
so that the state of the reference can be displayed by frontend
consuming the heap snapshot.
nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 27, 2022

Copy link
Copy Markdown
Collaborator

legendecas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM but linter is complaining.

Copy link
Copy Markdown
Collaborator

joyeecheung added the review wanted PRs that need reviews. label Sep 29, 2022
joyeecheung removed the review wanted PRs that need reviews. label Oct 3, 2022

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

joyeecheung added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Oct 5, 2022
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 5, 2022

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/44803
✔  Done loading data for nodejs/node/pull/44803
----------------------------------- PR info ------------------------------------
Title      src: implement GetDetachedness() in MemoryRetainerNode (#44803)
Author     Joyee Cheung  (@joyeecheung)
Branch     joyeecheung:detached-retainer -> nodejs:main
Labels     c++, needs-ci, commit-queue-squash
Commits    2
 - src: implement GetDetachedness() in MemoryRetainerNode
 - fixup! src: implement GetDetachedness() in MemoryRetainerNode
Committers 1
 - Joyee Cheung 
PR-URL: https://github.com/nodejs/node/pull/44803
Reviewed-By: Chengzhong Wu 
Reviewed-By: James M Snell 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/44803
Reviewed-By: Chengzhong Wu 
Reviewed-By: James M Snell 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 27 Sep 2022 07:24:01 GMT
   ✔  Approvals: 2
   ✔  - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/44803#pullrequestreview-1124920321
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/44803#pullrequestreview-1127622249
   ✖  Last GitHub CI failed
   ℹ  Last Full PR CI on 2022-10-04T17:02:48Z: https://ci.nodejs.org/job/node-test-pull-request/47071/
- Querying data for job/node-test-pull-request/47071/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/3189452691

nodejs-github-bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Oct 5, 2022
joyeecheung added a commit that referenced this pull request Oct 5, 2022
This allows us to mark weak/detached references in the heap snapshot.
Also mark weak/detached BaseObject with Detachedness::kDetached
so that the state of the reference can be displayed by frontend
consuming the heap snapshot.

PR-URL: #44803
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
joyeecheung closed this Oct 5, 2022
danielleadams pushed a commit that referenced this pull request Oct 11, 2022
This allows us to mark weak/detached references in the heap snapshot.
Also mark weak/detached BaseObject with Detachedness::kDetached
so that the state of the reference can be displayed by frontend
consuming the heap snapshot.

PR-URL: #44803
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-failed An error occurred while landing this pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL