mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
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:
committed by
Steve Howell
parent
fc78a2cc66
commit
f1e110c177
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user