Closed Bug 203698 Opened 22 years ago Closed 22 years ago

memory consumption on reloading images in DHTML

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 193865

People

(Reporter: arysin, Unassigned)

References

Details

(Keywords: perf)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030428 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030428 when reloading images for one HTML image element the memory seems get allocated for every image and freed up only when browser leaves the page if one views images at 10FPS 640x480, it can eat hundreds of megs in less than a 30 sec. Reproducible: Always Steps to Reproduce: 1. try html code atached in additional information, replacing /camera/servlet/Picture?v=0 with some image location (better dynamic one) 2. open this page in Mozilla 3. start top or other memory monitoring tool Actual Results: The memory use for X server increases drastically, it seems like mozilla uses X allocation procedures The memory is freed up when only when one exits the page After some time viewing this page Mozilla brings system down for swapping, this is especially bad if X is running with higher priority, 'cause this may cause system lock ups Interesting: on Win98 memory use goes up to some value and then drops down at some point then again goes up and drops - thus working stable there. Expected Results: more efficient memory allocation algorithm needed for dynamic image reloading <html> <head> <script language="JavaScript"> function startstream() { document.dynamicimage.onload=getimage; document.dynamicimage.src = "/camera/servlet/Picture?v=0; } function getimage(){ document.dynamicimage.src = "/camera/servlet/Picture?v=0"; } </script> </head> <body onload="startstream()"> <img width=640 height=480 src="Picture?v=0" name=dynamicimage> </body> </html>
Bug 203667 has an URL (webcam) showing that behaviour. Bug 203667 GDI objects overflow (Win) and X11 server size increase (Linux) when reloading images by javascript
Depends on: 193865
If you load a page a few times in another window, and wait a few seconds, does any memory get freed then? I'm wondering if this has anything to do with the JS garbage collector, loading a page in any window will trigger a global GC, but it will be delayed ~2 seconds.
yes, if I open a page with image regularly updated through JavaScrpit and then open some page in another window memory usage gets dropped to initial value
Where's the testcase attachment(s)? The DOM code should call JS_MaybeGC after replacing an image src programmaticly, or something like that. Easy patch -- jst or peterv? Confirming bug. /be
I meant to confirm this, but actually, I'll let someone else confirm that this is a dup of the dependency bug 193865, and mark it as such (removing the bogo-dep). /be
Hmm, I don't know exactly what's going on here, but I doubt a JS_MaybeGC() call would do much good. JS_MaybeGC() will only do a GC if enough *JS* garbage has been generated since the last GC, and I doubt that's the case here. My guess is that we're holding on to some large chunk of data (image data?) past the point where we need to, but I haven't had time to verify if that's actually the case. Btw, we run JS_MaybeGC() every 20th event handler call, i.e. wiggle your mouse around for a while, and chances are that we call JS_MaybeGC(). If that doesn't cause memory to be released, then we need more than a JS_MaybeGC() call here...
does event handler has to be on for mousemove or JS_MaybeGC() will be called anyway? I tried without and it did not help.
Every 20th JS evailuation we call JS_MaybeGC() (from nsJSContext::ScriptEvaluated()), that means any JS event handler, JS timeout, or execution of a <script> element, or anything else that ends up calling the same internal function. IOW, it's not limited to mouse moves.
Blocks: 21762
Keywords: perf
This should be probably closed as a dup of bug 203698 this works as implemented... see my comments in that bug
Well, this is bug 203698 :) What bug were you thinking of?
Maybe he means bug 199443? Cause bug 193865 was dupe to it.
marking dupe *** This bug has been marked as a duplicate of 193865 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
No longer blocks: 21762
Blocks: 21762
No longer blocks: 21762
Blocks: 21762
Component: DOM: HTML → DOM: Core & HTML
QA Contact: desale → general
You need to log in before you can comment on or make changes to this bug.