[webkit-dev] innerHTML and removeChild ... not freeing memory

g_siddu siddu.sjce at gmail.com
Tue Mar 31 22:42:26 PDT 2009


Hi Puroshatam ,

Ensure that cache is enabled  .  m_disabled(false) (WebCore/loader/Cache.cpp
)  and let us know your observation.

Regards,
Siddu




Purushottam Sholapur wrote:
> 
> Hi all,
> 
> I am using QT/Webkit-4.5 (embeded version) on linux. I am trying to use
> createElement, innerHTML, appendChild and later removeChild.
> 
> UI Output is perfectly fine. But when I do removeChild, div momory is not
> freed. Is there anything wrong with the code. Since the div contains
> image,
> lot of memory is hogged and not freed.
> 
> ------------Below is the code...
> Click on "Add Some Elements" to add the div to innerHTML
> Click on "Remove the div" to remove the div
> ------------
> <html>
>     <head>
>         <title>Test script</title>
>         <script language="javascript">
>         function removeElement(divNum) {
>             var divIdN = 'my'+divNum+'Div';
>             var olddiv = document.getElementById(divIdN);
>             olddiv.parentNode.removeChild(olddiv);
>             olddiv = null;
>         }
>         function addElement() {
>             var ni = document.getElementById('myDiv');
>             var numi = document.getElementById('theValue');
>             var num = (document.getElementById('theValue').value -1)+ 2;
>             numi.value = num;
>             var newdiv = document.createElement('div');
>             var divIdName = 'my'+num+'Div';
>             newdiv.setAttribute('id',divIdName);
>             ni.appendChild(newdiv);
>             newdiv.innerHTML = 'Element Number '+num+' has been added! 
> \'#\' Remove the div
> "'+divIdName+'" '+' "
http://www.play-montreal.com/wordpress/wp-content/uploads/2007/10/biosphere-1.jpg<http://localhost/share/biosphere-1.jpg
"
> />';
>             ni = null;
>             newdiv = null;
>         }
>         </script>
> </head>
> <body>
> <input type="hidden" value="0" id="theValue" />
> <p> javascript:; Add Some Elements </p>
> <div id="myDiv"> </div>
> </body>
> </html>
> -----------------
> regards
> Purush
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/innerHTML-and-removeChild-...-not-freeing-memory-tp22704881p22820151.html
Sent from the Webkit mailing list archive at Nabble.com.



More information about the webkit-dev mailing list