Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks in data table / jqplot #11354

Merged
merged 2 commits into from Mar 27, 2017
Merged

Fix memory leaks in data table / jqplot #11354

merged 2 commits into from Mar 27, 2017

Commits on Feb 18, 2017

  1. 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.
    John Vilk committed Feb 18, 2017
    Copy the full SHA
    ca366b3 View commit details
    Browse the repository at this point in the history
  2. 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.
    John Vilk committed Feb 18, 2017
    Copy the full SHA
    1b871d5 View commit details
    Browse the repository at this point in the history