Empty large collections and remove event listeners before reload

Chrome was showing a memory leak after many auto-reloads. Emptying the
the collections and removing the event listeners reduces the severity.
Before this change 40 reloads would would grow to about 140MB, now it
stays around 50MB.

(imported from commit 55fbeff9bdd0363bb95929f2981a2de238ff35d8)
This commit is contained in:
Jason Michalski
2014-02-05 13:49:18 -05:00
committed by Steve Howell
parent fc78a2cc66
commit f1e110c177
3 changed files with 37 additions and 3 deletions

View File

@@ -327,7 +327,7 @@ $(function () {
get_events();
});
function cleanup_event_queue() {
exports.cleanup_event_queue = function cleanup_event_queue() {
// Submit a request to the server to cleanup our event queue
if (page_params.event_queue_expired === true) {
return;
@@ -336,10 +336,10 @@ function cleanup_event_queue() {
url: '/json/events',
data: {queue_id: page_params.event_queue_id}
});
}
};
window.addEventListener("beforeunload", function (event) {
cleanup_event_queue();
exports.cleanup_event_queue();
});