diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-01-29 19:41:26 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-02-03 18:04:13 +0300 |
commit | 875a4d1a58d6dec80518c9d2a05ae6107c70b066 (patch) | |
tree | 5223080453453fe6617e45dcc0df36e44695dab9 /doc/api/worker_threads.md | |
parent | f7a1ef6fb51f814223e3c26fffb9d39b08f91b1b (diff) |
worker: add ability to take heap snapshot from parent thread
PR-URL: https://github.com/nodejs/node/pull/31569
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'doc/api/worker_threads.md')
-rw-r--r-- | doc/api/worker_threads.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 6812e6966da..6ae0ada97f1 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -674,6 +674,21 @@ inside the worker thread. If `stdout: true` was not passed to the [`Worker`][] constructor, then data will be piped to the parent thread's [`process.stdout`][] stream. +### `worker.takeHeapSnapshot()` +<!-- YAML +added: REPLACEME +--> + +* Returns: {Promise} A promise for a Readable Stream containing + a V8 heap snapshot + +Returns a readable stream for a V8 snapshot of the current state of the Worker. +See [`v8.getHeapSnapshot()`][] for more details. + +If the Worker thread is no longer running, which may occur before the +[`'exit'` event][] is emitted, the returned `Promise` will be rejected +immediately with an [`ERR_WORKER_NOT_RUNNING`][] error. + ### `worker.terminate()` <!-- YAML added: v10.5.0 @@ -716,6 +731,7 @@ active handle in the event system. If the worker is already `unref()`ed calling [`'exit'` event]: #worker_threads_event_exit [`AsyncResource`]: async_hooks.html#async_hooks_class_asyncresource [`Buffer`]: buffer.html +[`ERR_WORKER_NOT_RUNNING`]: errors.html#ERR_WORKER_NOT_RUNNING [`EventEmitter`]: events.html [`EventTarget`]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget [`MessagePort`]: #worker_threads_class_messageport @@ -743,6 +759,7 @@ active handle in the event system. If the worker is already `unref()`ed calling [`require('worker_threads').threadId`]: #worker_threads_worker_threadid [`require('worker_threads').workerData`]: #worker_threads_worker_workerdata [`trace_events`]: tracing.html +[`v8.getHeapSnapshot()`]: v8.html#v8_v8_getheapsnapshot [`vm`]: vm.html [`worker.on('message')`]: #worker_threads_event_message_1 [`worker.postMessage()`]: #worker_threads_worker_postmessage_value_transferlist |