node/test/pummel/test-heapdump-dns.js
Joyee Cheung 3ab2d4f362
src: implement GetDetachedness() in MemoryRetainerNode
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: https://github.com/nodejs/node/pull/44803
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-05 19:38:39 +08:00

19 lines
583 B
JavaScript

// Flags: --expose-internals
'use strict';
require('../common');
const { validateSnapshotNodes } = require('../common/heap');
validateSnapshotNodes('Node / ChannelWrap', []);
const dns = require('dns');
validateSnapshotNodes('Node / ChannelWrap', [{}]);
dns.resolve('localhost', () => {});
validateSnapshotNodes('Node / ChannelWrap', [
{
children: [
{ node_name: 'Node / NodeAresTask::List', edge_name: 'task_list' },
// `Node / ChannelWrap` (C++) -> `ChannelWrap` (JS)
{ node_name: 'ChannelWrap', edge_name: 'wrapped' },
],
detachedness: 2
},
]);