From 6bdfb1f8f01ed7832039c6c10668dd1209d32cc5 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 8 Jan 2018 13:32:30 -0800 Subject: [PATCH] perf_hooks,http2: add performance.clear() Add missing clear() method to `perf_hooks.performance` to remove the entries from the master timeline to prevent that from being a memory leak. Backport-PR-URL: https://github.com/nodejs/node/pull/20456 PR-URL: https://github.com/nodejs/node/pull/18046 Reviewed-By: Matteo Collina --- doc/api/perf_hooks.md | 8 ++++++++ lib/perf_hooks.js | 4 ++++ test/parallel/test-http2-perf_hooks.js | 10 +++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index 9b4ffb7ccb63c6..2f2910af93db34 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -29,6 +29,14 @@ added: v8.5.0 The `Performance` provides access to performance metric data. A single instance of this class is provided via the `performance` property. +### performance.clearEntries(name) + + +Remove all performance entry objects with `entryType` equal to `name` from the +Performance Timeline. + ### performance.clearFunctions([name])