diff options
author | Wu Cheng-Han | 2016-10-10 21:05:49 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-10-10 21:05:49 +0800 |
commit | b734eb9c85fc6b2cfe534206f0f1b01656d9acc3 (patch) | |
tree | 4cc7c71c2942a490abbe207040cf3daac0b0194b | |
parent | 138aa876f4fa66dd85a5f3d0fc15ffd76c441022 (diff) |
Try to fix memory leaks by clear OT server before disconnect note
Diffstat (limited to '')
-rw-r--r-- | lib/realtime.js | 3 |
1 files changed, 3 insertions, 0 deletions
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) { |