Closed
Bug 389704
Opened 18 years ago
Closed 1 year ago
Large memory leak when changing textarea.value
Categories
(Core :: DOM: Core & HTML, defect, P5)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: yann.hamon, Unassigned)
Details
(Keywords: testcase)
Attachments
(1 file)
1.04 KB,
text/html;charset=utf-8
|
Details |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)
Hello,
I built a javascript "logging" in a textarea; like textarea += text, and this 3000 times. The more text there is, the more memory it uses, and the fastest the memory footprint grows.
The exact line was:
document.getElementById("pl_dokukiwix_log").value += currentHours+":"+currentMinutes+":"+currentSeconds+" "+logstring+"\n";
This line (after being called 1000 times) caused firefox to use over 500MB of memory; deleting this line solved the memory problem.
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Updated•18 years ago
|
Component: General → DOM: HTML
Product: Firefox → Core
QA Contact: general → general
Summary: Important memory leak when working with textarea → Large memory leak when changing textarea.value
Comment 1•18 years ago
|
||
Minimal testcase would be great.
I tested the latest trunk nightly under WinXP with 300 iterations, 1000 took far too long. You could also take a look at the testcase for bug 190147.
With this test, I get the following numbers for firefox.exe's VM Size as reported by Task Manager:
New start with testcase loaded: 23332K.
Press the first button, VM Size climbs to 23672K.
Press the second button, VM Size climbs from 23672K to 58328K.
Leave the browser alone for a minute, VM Size drops to 50816K.
Textarea's value.length after running this test is 15600.
Comment 3•16 years ago
|
||
I got this problem also when I tried to use two textareas, one as a log (same as original bug reporter) and another textarea for outputting data.
I got the problem with Firefox 3.0.7, on Vista. On this system with 3GB of RAM, Firefox crashes after using 1.8GB of memory.
I also got the problem on XP. On this system with 2GB of RAM , Firefox starts out using 38MB and tops out at 440MB. I even paused the logging and it did not recover any memory.
I found a workaround where I removeChild the textarea and createElement/appendChild a new textarea with same configuration. This seems to contain the memory leak.
I do something like this to solve the problem:
-----------------------------------------------------------------------------------------
var logtext = document.getElementById("texttest").value;
logtext = "" + hour + ":" + minute + ":" + second + " " + newlogtext + "\r\n" + logtext;
// delete current textarea node
document.getElementById("texttest_div").removeChild(document.getElementById("texttest"));
// create a new text area and set its attributes same as the original text area
var textarea_element = document.createElement("textarea");
textarea_element.id = "texttest";
textarea_element.readonly = "true";
textarea_element.rows = "20";
textarea_element.cols = "120";
textarea_element.value = logtext;
document.getElementById("texttest_div").appendChild(textarea_element);
(In reply to comment #0)
Stop bothering developers with this minor problem, you are the only one, who has it
Comment 5•15 years ago
|
||
#4: If you cannot confirm the described problem, please tell us.
I tested with Minefield (latest) on Win 7.
The Memory rise was only about 4/5 MB. (I have 512 MB totally)
When setting iterations to 1000 the memory usage rose up to 52MB (from 48MB) and then did not change. After some time I closed the Firefox window, cause it took so long.
Comment 6•15 years ago
|
||
The testcase runs fast on trunk builds.
Is there anything which hints that there might be (still?) some memory leak?
Comment 7•15 years ago
|
||
excuses for comment 4, some is spamming various bugs, see bug 567347
Comment 8•7 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
Updated•3 years ago
|
Severity: normal → S3
Comment 9•1 year ago
|
||
I don't think I've seen something obviously wrong when running the test case. Also, the code has changed a lot since the bug was reported. Please file a new report, attach a test case with memory log, if you see a problem with the latest Firefox versions. Thanks.
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•