[webkit-help] Memory consumption problem

Carlos Varela Paz carlos.varela at lambdastream.com
Mon Jan 17 04:20:14 PST 2011


Hi All,

I am experimenting some memory problems that I can not understand. I hope
someone on this list could help me to get some kind of explanation :)

I have created a simple web page that changes the innerHTML property of a
div element each 2000ms. The page is extremelly simple, it only contains a
DIV element and it launch an interval when the page is loaded. The source
code of the body is:

    <body onload="start()">
        <div id="main"></div>
    </body>

The start() function launch the interval with the function that is in charge
of updating the div content, its definition is:

            function start(){
                setInterval(reloadHTML, 2000);
            };

My problem is with the implementation of the reloadHTML function.  If I
implement it as:

            var str = longStr();

            function reloadHTML(){
                console.log("Reload...");
                document.getElementById("main").innerHTML =
"anything"+str+"anything";
            }

the memory grows infinitely.

If I remove the concatenation and let the reloadHTML() function as:

            var str = longStr();

            function reloadHTML(){
                console.log("Reload...");
                document.getElementById("main").innerHTML = str;
            }

the memory remains stable (oscillating up and down, but not growing).

Also, moving the variable definition inside the function solves the memory
consumption problem:

  function reloadHTML(){
                console.log("Reload...");
                var str = longStr();
                document.getElementById("main").innerHTML =
"anything"+str+"anything";
            }

Is this a bug or do I miss something?

I am using QT 4.7.0, wich includes the version 533.3 of webkit. The source
is configured with the following options:

./configure -embedded x86 -platform qws/linux-generic-g++-32\
            -prefix /mnt/hed_project/cross_compiled_t3/qt_x86_bin_4.7.0
-qvfb\
            -force-pkg-config -webkit -openssl-linked -no-glib -opensource
-no-nis -no-cups -no-dbus -qt-freetype\
            -plugin-gfx-directfb -plugin-gfx-vnc -no-qt3support
-no-accessibility -no-xmlpatterns -nomake tools\
            -nomake docs -nomake examples -nomake translations -fast\
            -qt-kbd-tty -qt-kbd-qvfb -qt-mouse-pc -qt-mouse-qvfb
-no-gfx-transformed -no-gfx-multiscreen\
            -phonon -no-phonon-backend

Any help will be very appreciated.

Best regards,

Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20110117/84ede827/attachment-0001.html>


More information about the webkit-help mailing list