MCPcopy Index your code
hub / github.com/nodejs/node / initializeHeapSnapshotSignalHandlers

Function initializeHeapSnapshotSignalHandlers

lib/internal/process/pre_execution.js:512–535  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

510}
511
512function initializeHeapSnapshotSignalHandlers() {
513 const signal = getOptionValue('--heapsnapshot-signal');
514 const diagnosticDir = getOptionValue('--diagnostic-dir');
515
516 if (!signal)
517 return;
518
519 require('internal/validators').validateSignalName(signal);
520 const { writeHeapSnapshot } = require('v8');
521
522 function doWriteHeapSnapshot() {
523 const heapSnapshotFilename = getHeapSnapshotFilename(diagnosticDir);
524 writeHeapSnapshot(heapSnapshotFilename);
525 }
526 process.on(signal, doWriteHeapSnapshot);
527
528 // The code above would add the listener back during deserialization,
529 // if applicable.
530 if (isBuildingSnapshot()) {
531 addSerializeCallback(() => {
532 process.removeListener(signal, doWriteHeapSnapshot);
533 });
534 }
535}
536
537function setupTraceCategoryState() {
538 const { isTraceCategoryEnabled } = internalBinding('trace_events');

Callers 1

prepareExecutionFunction · 0.85

Calls 6

getOptionValueFunction · 0.85
isBuildingSnapshotFunction · 0.85
addSerializeCallbackFunction · 0.85
requireFunction · 0.50
onMethod · 0.45
removeListenerMethod · 0.45

Tested by

no test coverage detected