Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#9531 closed bug (fixed)

Tooltip: memory leak - not unbinding remove event

Reported by: mdownes Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.tooltip Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

Hi, There seems to be a memory leak in the tooltip where the remove event never gets unbound. Please see the jsfiddle test below for a demonstration. Basically , after hovering over the textbox more and more remove events get bound added and none get unbound. I found this in version 1.9.2 but the test below uses the latest version and it is still present.

http://jsfiddle.net/kD6MS/3/

Kind Regards,

Maurice

Change History (7)

comment:1 Changed 4 years ago by tj.vantoll

Status: newopen
Summary: Tooltip memory leak - not unbinding remove eventTooltip: memory leak - not unbinding remove event

Confirmed. A remove handler is bound everytime to tooltip is opened but is only removed for delegated targets:

// Remove 'remove' binding only on delegated targets
if ( target[0] !== this.element[0] ) {
    this._off( target, "remove" );
}

This might be addressed by the text for #8740.

comment:2 Changed 4 years ago by robotdan

Fork of the initial jsFiddle w/ the patch from #8740 http://jsfiddle.net/robotdan/v99hx/

Assuming I'm picking up the patched jquery.ui.tooltip.js it looks like the issue still exists.

comment:3 Changed 4 years ago by robotdan

The code block referenced above in comment 1 was added as a result of #8646 under commit https://github.com/jquery/jquery-ui/commit/3b2d1e7736be99671af70aa3b775d67b917517e5.

Some additional investigation should be done to see if the remove handler can always be removed or if some additional logic is required to resolve this issue as well as preserve the fix for #8846.

comment:4 in reply to:  2 Changed 4 years ago by tj.vantoll

Replying to robotdan:

Fork of the initial jsFiddle w/ the patch from #8740 http://jsfiddle.net/robotdan/v99hx/

Assuming I'm picking up the patched jquery.ui.tooltip.js it looks like the issue still exists.

You are bringing in the script file appropriately, so it looks like that fix doesn't address this issue.

comment:6 Changed 4 years ago by Scott González

Resolution: fixed
Status: openclosed

Tooltip: Only bind remove handler for delegated tooltips

The remove handler was being added for every tooltip, but only removed for delegated tooltips. The default destroy behavior already handles non-delegated tooltips, so the handler should only be added for delegated tooltips.

Fixes #9531 Closes gh-1156

Changeset: a8ff77360b78b7eabcffd97b8b11c2d1f150ed4e

comment:7 Changed 4 years ago by Scott González

Milestone: none1.11.0
Note: See TracTickets for help on using tickets.