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.
1 //----------------------------------------------------------------------------------------------------2 3 // oSrcCtrl – Parent Control where dynamic iframe to be attached (DIV)4 // strFraId - Iframe Identifier5 //-----------------------------------------------------------------------------------------------------6 7 function CreateIFrame(oSrcCtrl,strFraId) {8 9 var iframe = document.createElement("iframe");10 11 iframe.setAttribute("id", strFraId);12 13 iframe.setAttribute("scrolling", "no");14 15 iframe.setAttribute("frameBorder", "0"); 16 17 oSrcCtrl.appendChild(iframe);18 19 }20 21 //--------------------------------------------------------------------------------------------------------22 23 // oSrcCtrl – Parent Control where dynamic iframe to be attached (DIV)24 // strFraId - Iframe Identifier25 //---------------------------------------------------------------------------------------------------------26 function DestroyIframeById(oSrcCtrl, strFraId)27 { 28 29 if (document.all)30 31 { 32 33 document.getElementById(strFraId).src = 'BLOCKED SCRIPTfalse';34 35 document.all[strFraId].outerHTML = '';36 37 }else{38 39 oSrcCtrl.removeChild(document.getElementById(strFraId));40 41 } 42 43 }
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.
Hello,
Just wanted to let you know that we are also following this forum thread:
http://forums.infragistics.com/forums/t/11139.aspx
There is a difference between server-side memory leaks (you can investigate them with ANTS profiler) and client-side browser leaks - Internet Explorer, FireFox, etc - you can investigate them with Sieve or Drip. So if you share some additoinal details we might be able to help (although frankly, depending on complex scenarios where new iframes are added dynamically there are some built-in problems in browsers that are hard to overcome).
It's a bit ironic, but unfortunately these problems are so common for IE, that Microsoft has called them patterns and has a specialized article on MSDN that provides some suggestions and workarounds that may alleviate the problem:
Understanding and Solving Internet Explorer Leak Patterns
http://msdn.microsoft.com/en-us/library/bb250448(VS.85).aspx