Bug Tracker

Opened 9 years ago

Closed 9 years ago

#15235 closed bug (migrated)

.css('marginRight') - memory leak

Reported by: flexphperia Owned by:
Priority: high Milestone: None
Component: css Version: 2.1.1
Keywords: memory leak, reliableMarginRight Cc:
Blocked by: Blocking:

Description

I have found memory leak in reliableMarginRight function.

Memory leak is created when you call $element.css('marginRight')

JsFiddle: http://fiddle.jshell.net/z3jo9k1q/show/light/

Test case:

  1. open above address in Chrome,
  2. open developer tools, make Heap snapshot,
  3. click on button in jsfiddle example, red element will be removed
  4. make another heap snapshot with browser tools
  5. compare snapshots, you will find one HtmlDivElement that is detached from DOM but keeping reference in reliableMarginRight function

Fix: Adding this, after 5665 line in jQuery uncompressed code will fix the problem:

docElem.removeChild( container );
div.removeChild( marginDiv ); //this is new line

Change History (3)

comment:1 Changed 9 years ago by flexphperia

Here's direct link to jsFiddle : http://fiddle.jshell.net/z3jo9k1q/
Click RUN before testing for memory leaks in Chrome.

Is there any chances to fix this bugi in next release? It's quite important.

comment:2 Changed 9 years ago by dmethvin

Status: newopen

comment:3 Changed 9 years ago by m_gol

Resolution: migrated
Status: openclosed
Note: See TracTickets for help on using tickets.