From 765668b3d3c414e45036026fe6843773be80d1b7 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 10 Nov 2015 20:40:36 -0800 Subject: [PATCH] Clear message collections when the window is closed We don't need to keep them in memory if we're done viewing them, plus it avoids having to re-render a large collection when we re-open a conversation. Now that we only load a sensible number of messages at a time, caching them between usages is less valuable. Removing them from the collection should free them for garbage collection. // FREEBIE --- js/views/conversation_view.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 085c85f1a0..39768a2f0a 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -62,6 +62,7 @@ this.appWindow.contentWindow.removeEventListener('focus', onFocus); window.autosize.destroy(this.$messageField); this.remove(); + this.model.messageCollection.reset([]); }.bind(this)); this.fetchMessages();