diff --git a/lib/weak-set.js b/lib/weak-set.js index 6f94988..1ef6b6c 100644 --- a/lib/weak-set.js +++ b/lib/weak-set.js @@ -1,3 +1,5 @@ +const { WeakSet } = global; + /** * IMPORTANT: MockWeakSet intentionally omits unused methods (like delete) */ @@ -13,7 +15,5 @@ function MockWeakSet(mws = []) { } export default function MaybeWeakSet(iterable) { - // WeakSet causes a horrible memory leak in node so just use the mock for now - // https://github.com/nodejs/node/issues/6180 - return MockWeakSet(iterable); + return WeakSet ? new WeakSet(iterable) : MockWeakSet(iterable); } diff --git a/package.json b/package.json index 91241e9..f173d22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitclock", - "version": "0.2.0-beta.2", + "version": "0.2.0-beta.3", "license": "Apache-2.0", "repository": { "type": "git",