From 9c26df42130a80a7706dd5651fd1556e48f593a4 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 14 Aug 2019 15:12:44 +0200 Subject: [PATCH 1/2] Add comments --- www/common/sframe-common-outer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 0103cdbaf..153126f7c 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -864,6 +864,9 @@ define([ Cryptpad.removeLoginBlock(data, cb); }); + // It seems we have performance issues when we open and close a lot of channels over + // the same network, maybe a memory leak. To fix this, we kill and create a new + // network every 30 cryptget calls (1 call = 1 channel) var cgNetwork; var whenCGReady = function (cb) { if (cgNetwork && cgNetwork !== true) { console.log(cgNetwork); return void cb(); } From a327f4a0bf9693b52c1356c307532954c682972e Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 14 Aug 2019 15:59:16 +0200 Subject: [PATCH 2/2] Fix cryptget memory issues --- www/common/cryptget.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/www/common/cryptget.js b/www/common/cryptget.js index 6d18b2083..9ca05164c 100644 --- a/www/common/cryptget.js +++ b/www/common/cryptget.js @@ -21,6 +21,11 @@ define([ S.leave(); } catch (e) { console.log(e); } } + if (S.session && S.session.stop) { + try { + S.session.stop(); + } catch (e) { console.error(e); } + } var abort = Util.find(S, ['session', 'realtime', 'abort']); if (typeof(abort) === 'function') { S.session.realtime.sync();