Fix memory leaks in data table / jqplot (#11354)
* Fixes memory leaks in dataTable and jqplot via uncleared resize handlers Previously, these plugins registered a handler on the `resize` event on window, but used ad-hoc heuristics to determine when to remove the handler: * dataTable would only remove the handler the next time the `resize` event fires, which is not guaranteed to happen regularly (especially if the user is not regularly resizing their browser window, e.g., it is full screened) * Fix: I define `_destroy` on `dataTable`, which appropriately cleans up the handler (and calls the `_destroy` method of its parent class, `UIControl`) * jqplot contained code to remove the `resize` listener when `destroyPlot()` is called, but a) this function is not called when the plot is removed from the DOM (the code called `destroy()` on the `plot` object directly), and b) it incorrectly uses `this` instead of `self`, preventing it from working in the first place. * Fix: I fixed the `this`/`self` confusion, and changed the cleanup code such that `$.jqplot.visiblePlots` contains `JqplotGraphDataTable` objects rather than `jqplot` objects. These event handlers prevented previous jqplot and datatable objects from being garbage collected each time the dashboard is refreshed. * Prevent leaking data tables via body mouseup handlers. Adds code to clean up mouseup handlers on the body HTML element when data tables are destroyed. Previously, these handlers caused data tables to remain in memory forever.
parent
0f887dcb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Chargement en cours
Veuillez vous inscrire ou vous se connecter pour commenter