471,852 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,852 software developers and data experts.

Dynamic Iframe (inside ModalPopUpControl ) Memory Leak In Internet Explorer

I have an Infragistics UltrawebGrid [hierarchical grid with 3 levels]. Each Row in the grid is attached to a context menu using Infragistics CSOM [Client Side Object Model]

Upon click on the menu, I am creating an Iframe dynamically which points to another page in the same domain [same web application] which also contains infragistics datagid [non hierarchical] populated with default data retrieved from Data Base. After creating the frame I am attaching it to the HTML DOM [Div Layer] and show it as modal popup with OK and Cancel Button inside an ModalPopUpControl Extender. Upon click on any of the buttons, I am destroying the Iframe from DOM. I am calling ModalPopUpControl show() and hide() methods for displaying and canceling modal popup.

Following are the functions I am using for Iframe Creation and Destroy.
Expand|Select|Wrap|Line Numbers
  2.     //----------------------------------------------------------------------------------------------------
  4.     // oSrcCtrl – Parent Control where dynamic iframe to be attached (DIV)
  5.     // strFraId - Iframe Identifier
  6.     //-----------------------------------------------------------------------------------------------------
  8.     function CreateIFrame(oSrcCtrl,strFraId) {
  10.         var iframe = document.createElement("iframe");
  12.        iframe.setAttribute("id", strFraId);
  14.        iframe.setAttribute("scrolling", "no");
  16.        iframe.setAttribute("frameBorder", "0");   
  18.        oSrcCtrl.appendChild(iframe);
  20.    }
  22.    //--------------------------------------------------------------------------------------------------------
  24.    // oSrcCtrl – Parent Control where dynamic iframe to be attached (DIV)
  25.    // strFraId - Iframe Identifier
  26.    //---------------------------------------------------------------------------------------------------------
  27.    function DestroyIframeById(oSrcCtrl, strFraId)
  28.    {    
  30.        if (document.all)
  32.        {       
  34.            document.getElementById(strFraId).src = 'javascript:false';
  36.            document.all[strFraId].outerHTML = '';
  38.               }else{
  40.            oSrcCtrl.removeChild(document.getElementById(strFraId));
  42.        }  
  44.    }
Repeatedly clicking on the menu [for iframe creation] & OK, Cancel button [for destroying iframe] causing huge performance bottleneck. The amount of memory used by the IE keeps on increasing for each clicks I.e. [Dynamic Creation of iframe and Removing the same after button click] but while unloading the page i.e. navigating to a different page the IE memory usage comes to normal.

I would need your help to validate my JavaScript codes for Iframe creation and Remove. Also request you guys to suggest some alternate solutions to get away this memory leak.

I Just downloaded Javascript Memory leak detector from http://blogs.msdn.com/gpde/pages/jav...-detector.aspx and yet to profile my code, once i am done with that I'll update this post with my results and in the mean time i would appreciate any help. Showing and Hiding ModalPopUpControl using javascript code (behaviour.show() & behaviour.hide()) will casue any memory leak?


1. The response time to load the iframe is not an issue; it loads with in the expected time

2. For each Iframe request the response size is nearly 500KB [includes data retrieved from database + infragistics JavaScript resource files]
Mar 29 '08 #1
1 4655
16,027 Expert Mod 8TB
Instead of continuously creating and destroying iframes, reuse the same one(s).

If you must, consider a timeout too to allow the frame to be removed.

Another tool for detecting leaks is Drip.
Jun 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Keon | last post: by
10 posts views Thread by s.subbarayan | last post: by
3 posts views Thread by Stevie_mac | last post: by
2 posts views Thread by m0nkeymafia | last post: by
8 posts views Thread by BillE | last post: by
reply views Thread by NeoPa | last post: by
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.