Open Bug 389704 Opened 15 years ago Updated 4 years ago
Large memory leak when changing textarea
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
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.
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
#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.
The testcase runs fast on trunk builds. Is there anything which hints that there might be (still?) some memory leak?
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
You need to log in before you can comment on or make changes to this bug.