Skip to content

.css('marginRight') - memory leak #1795

Closed
@mgol

Description

@mgol

Originally reported by flexphperia at: http://bugs.jquery.com/ticket/15235

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

Issue reported for jQuery 2.1.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions