Side navigation
#11809 closed bug (fixed)
Opened May 24, 2012 12:16PM UTC
Closed June 26, 2012 06:50PM UTC
Last modified November 05, 2013 10:15PM UTC
Memory leak in .text(val) setter?
Reported by: | jase.williams@gmail.com | Owned by: | gibson042 |
---|---|---|---|
Priority: | low | Milestone: | 1.8 |
Component: | manipulation | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When hovering over an element multiple times I've noticed Chrome Dev Tools up my dom node count which very quickly gets high.
Is this supposed to happen?
STEPS TO REPRODUCE PROBLEM
Open http://jsfiddle.net/A367T/4/ in Chrome
Open Dev tools, navigate to Timeline, then click memory. Set your timeline to record.
Hover on and off the black square and watch the DOM NODE COUNT go up and up.
Is this a memory leak?
Attachments (0)
Change History (9)
Changed May 24, 2012 01:11PM UTC by comment:1
component: | unfiled → manipulation |
---|---|
milestone: | None → 1.8 |
priority: | undecided → low |
status: | new → open |
summary: | Memory leak in hover? → Memory leak in .text(val) setter? |
Changed June 25, 2012 04:28PM UTC by comment:2
owner: | → gibson042 |
---|---|
status: | open → assigned |
Changed June 26, 2012 06:01PM UTC by comment:3
https://github.com/jquery/jquery/pull/837
Also: I'm not entirely certain I was able to reproduce this, so I'd really appreciate some confirmation that it's fixed.
Changed June 26, 2012 06:50PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | assigned → closed |
Clear elements to avoid leaking memory. Close gh-837. Fixes #11809
Changeset: b6d02735e955523adcf88ff92b3bc7ecb144c624
Changed June 26, 2012 08:57PM UTC by comment:5
It does seem to eventually collect a bunch of DOM elements, so I guess that's fixed. This whole area needs to be burned to the ground come 2.0 time. :D
Changed January 05, 2013 03:10PM UTC by comment:6
It not fixed in version 1.8.3 (browser chrome 23.0.1271.97 m, windows 7).
STEPS TO REPRODUCE PROBLEM Open http://jsfiddle.net/3RSWf/ in Chrome Open Dev tools, navigate to Timeline, then click memory, select range some seconds. You will see that DOM Node count increment on 2 objects per call .text().
Changed January 05, 2013 03:34PM UTC by comment:7
@Sysaninster, I see it creating nodes, but not *leaking* them. Can you post a link to a screen shot showing a leak? Also please use jquery-git.js rather than 1.7.2.
Changed January 06, 2013 10:39AM UTC by comment:8
I've done pull request https://github.com/jquery/jquery/pull/1113 , where I described of problem:
It code bring leak of memory (test in chrome 23.0.1271.97 m, windows 7). Because every call $('selector').text('any text'), create 2 DOM nodes, but .empty() can't remove they. Code for test http://jsfiddle.net/3RSWf/ (I tested with source from repository and v1.8.3) and result http://my.jetscreenshot.com/7184/20130106-r5yo-219kb . It pull request fix problem.
It looks like we may be leaking a documentFragment each time
.text(val)
is used. Really it shouldn't be necessary to go through as much of the code path as we do there, so I'll mark this for investigation.