console: delete timers that have ended

Currently, console timers that have been ended with timeEnd()
are not removed. This has the potential to leak memory. This
commit deletes ended timers from the containing Map.

PR-URL: https://github.com/nodejs/node/pull/3562
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
This commit is contained in:
Vladimir Varankin authored and cjihrig committed 2015-11-13 11:36:45 -05:00
1 parent d9734b7cc9
commit a5cce79ec3
2 files changed
+11

No files matched your search

+1
View File
@@ -68,6 +68,7 @@ Console.prototype.timeEnd = function(label) {
const duration = process.hrtime(time);
const ms = duration[0] * 1000 + duration[1] / 1e6;
this.log('%s: %sms', label, ms.toFixed(3));
this._times.delete(label);
};