From 72509bffc280f19e92b459adaa3c8ec410585bca Mon Sep 17 00:00:00 2001 From: Steve Sewell Date: Mon, 26 Sep 2016 18:04:56 -0700 Subject: [PATCH] fix(platform-node): Remove memory leak --- modules/platform-node/node-platform.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/platform-node/node-platform.ts b/modules/platform-node/node-platform.ts index f94d60f70..cb598c035 100644 --- a/modules/platform-node/node-platform.ts +++ b/modules/platform-node/node-platform.ts @@ -118,7 +118,7 @@ function s4() { /*implements PlatformRef*/ export class NodePlatform { static _noop = () => {}; - static _cache = new Map(); + static _cache = new WeakMap(); get platformRef() { return this._platformRef; } @@ -332,7 +332,7 @@ export class NodePlatform { let prebootCode = null; // TODO(gdi2290): hide cache in (ngPreboot|UniversalPreboot) let prebootConfig = null; - let key = (typeof preboot === 'object') && JSON.stringify(preboot) || null; + let key = (typeof preboot === 'object') && preboot || null; let prebootEl = null; let el = null; let lastRef = null;