From b734eb9c85fc6b2cfe534206f0f1b01656d9acc3 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 10 Oct 2016 21:05:49 +0800 Subject: Try to fix memory leaks by clear OT server before disconnect note --- lib/realtime.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/realtime.js b/lib/realtime.js index 0fcd2eaa..ea3735a6 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -543,6 +543,9 @@ function disconnect(socket) { if (note.server.isDirty) { updateNote(note, function (err, _note) { if (err) return logger.error('disconnect note failed: ' + err); + // clear server before delete to avoid memory leaks + note.server.document = ""; + note.server.operations = []; delete note.server; delete notes[noteId]; if (config.debug) { -- cgit v1.2.3