diff options
author | James M Snell <jasnell@gmail.com> | 2018-01-08 13:32:30 -0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-01-11 10:41:49 -0800 |
commit | 20fe04f113fb81423585077265d3026584989232 (patch) | |
tree | 207afd5bffa56416f95cbb04df50188428862fe6 /test/parallel/test-http2-perf_hooks.js | |
parent | 47a282293f62813a88b4c4ba18bc5e5246a6515c (diff) | |
download | android-node-v8-20fe04f113fb81423585077265d3026584989232.tar.gz android-node-v8-20fe04f113fb81423585077265d3026584989232.tar.bz2 android-node-v8-20fe04f113fb81423585077265d3026584989232.zip |
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.
PR-URL: https://github.com/nodejs/node/pull/18046
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-perf_hooks.js')
-rw-r--r-- | test/parallel/test-http2-perf_hooks.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/parallel/test-http2-perf_hooks.js b/test/parallel/test-http2-perf_hooks.js index 07d9c55ed7..e30d0ac83e 100644 --- a/test/parallel/test-http2-perf_hooks.js +++ b/test/parallel/test-http2-perf_hooks.js @@ -6,7 +6,7 @@ if (!common.hasCrypto) const assert = require('assert'); const h2 = require('http2'); -const { PerformanceObserver } = require('perf_hooks'); +const { PerformanceObserver, performance } = require('perf_hooks'); const obs = new PerformanceObserver(common.mustCall((items) => { const entry = items.getEntries()[0]; @@ -46,6 +46,7 @@ const obs = new PerformanceObserver(common.mustCall((items) => { default: assert.fail('invalid entry name'); } + performance.clearEntries('http2'); }, 4)); obs.observe({ entryTypes: ['http2'] }); @@ -100,3 +101,10 @@ server.on('listening', common.mustCall(() => { })); })); + +process.on('exit', () => { + const entries = performance.getEntries(); + // There shouldn't be any http2 entries left over. + assert.strictEqual(entries.length, 1); + assert.strictEqual(entries[0], performance.nodeTiming); +}); |