diff --git a/lib/util/LazySet.js b/lib/util/LazySet.js index e973f903c3c..18b12f2f6cc 100644 --- a/lib/util/LazySet.js +++ b/lib/util/LazySet.js @@ -79,6 +79,8 @@ class LazySet { } else { this._toMerge.add(iterable); this._needMerge = true; + // Avoid a memory leak + if (this._toMerge.size > 100000) this._merge(); } return this; }