Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE6 Frames & Memory Leak

Tags:

Before I start this question, I understand that every aspect of it is wrong. Please keep that in mind...

I have an CRM-ish intranet application with an integrated soft phone developed in 2001 that I've inherited. It's basically a collections application that integrates telephony controls with a web-based front end for account management. (Genesys telephony and an AS400-based collections system...using MQSeries)

I'm trying to modernize this application as much as I possibly can before I call it "end of life". As part of my attempts to modernize it, I've implemented jQuery & jQuery UI for my JS functionality and UI. I'm not going crazy with it, but it is pretty well ingrained.

Now, enter the problem: we currently use IE6 and the application is built using frames. The implementation of the jQuery libraries has exposed the sieve-like nature of the application from a memory perspective. It's currently consuming about 75Mb of memory on start up and grows to anywhere from 150Mb - 300Mb after about 2-3 hours. Then the browser crashes.

I've narrowed the memory leaks down to the cross-talk between the frames. I've tested the pages individually in sIEve and Drip and there are no leaks found. But access the pages within the frameset and it's a time bomb.

I know the answer is to redesign the application without frames and start using a better browser. There are two problems with that:

  1. I've tested this on IE9 and the issues are still there, but a little more controlled

  2. Redesigning the application would take about $500k and 6-12 months.

Does anyone know a way to resolve the "frame leak" issue? I know I haven't given any code examples but I'm just looking for general knowledge. I'm calling the IE CollectGarbage() method at onload and onunload for every page in the application but to no avail. I've tried calling the empty() method in jQuery. I've tried setting every child of the document.body element to null. Nothing is working.

I'd hate to have to back out all of these changes because there are actually some pretty large cost-cutting features that have been implemented.

ADDITIONAL INFO

I've managed to pinpoint the scenario in which the memory leaks occur. I thought it was "cross-talk" between frames but it seems that the memory leaks occur when a single frame is refreshed.

I set up a basic frameset with a 5 instances of the same page (one that I'm pretty sure has no leaks per sIEve).

<html>     <head>         <title>Frame Leak Test</title>     </head>     <frameset cols="*" rows="50%,50%" frameborder="1">         <frameset cols="33%,33%,34%" rows="100%">             <frame src="http://npasappgeneqa02/live/" />             <frame src="http://npasappgeneqa02/live/" />             <frame src="http://npasappgeneqa02/live/" />         </frameset>         <frameset cols="50%,50%" rows="100%">             <frame src="http://npasappgeneqa02/live/" />             <frame src="http://npasappgeneqa02/live/" />         </frameset>     </frameset> </html> 

The index page that is being loaded shows no leaks in sIEve.

When I load the frameset page in sIEve and click auto-refresh, there are no memory leaks reported. However, if I right-click -> refresh on an individual frame, 75% of the loaded items in the DOM get listed as leaks.

Obviously, the auto-refresh is equivalent to the F5/shift+F5 refresh. And that cleans out the memory for the page. But when an individual frame is reloaded, the memory never clears out...apparently. And every screen that my users have to see reloads into the main frame.

I can't simply refresh the frameset because there is a softphone in the frameset that will bring about Armageddon if it is refreshed or logged out of improperly.

Does anyone know of a way to control frameset memory without refreshing it?

like image 222
Doug Weaver Avatar asked Mar 09 '12 14:03

Doug Weaver


People also ask

Is ie6 still used?

Internet Explorer 6 was the last version to be called Microsoft Internet Explorer. The software was rebranded as Windows Internet Explorer starting in 2006 with the release of Internet Explorer 7. Internet Explorer 6 is no longer supported, and is not available for download from Microsoft.


2 Answers

You posted no code to judge this from...but many of these scenarios result from improper use of closures.

Reading includes, but is not limited to:

  • JavaScript Closures and Memory Leaks
  • Introducing the Closure
  • Plugging Those Memory Holes
like image 193
Prisoner ZERO Avatar answered Oct 19 '22 06:10

Prisoner ZERO


Just wanted to give an update on this particular situation. I think that I've found an acceptable solution to this memory leak issue:

  1. Instead of using the full jQueryUI library on pages where UI elements were needed, I used the individual minimized scripts (uicore + datepicker, etc).
  2. Wherever possible, I avoided UI elements that utilized the widget script as this is where the largest concentration of issues arose.
    • a. This caused me to have to write custom scripts for button elements and the accordion element.
  3. Since this application runs in a frameset, utilizing window methods (ie, window.onload, window.onunload) don't work as the window itself only loads or unloads with the frameset. To combat this, I implemented document.body methods, specifically, document.body.onbeforeunload and doing a global unbind to remove any references that were hanging out ($("*").unbind();).

With the methodology utilized above, my 4-hour memory consumption in IE6 (and IE8) has dropped from ~200-250Mb to ~80-95Mb. My goal was to keep 8-hour consumption under 150Mb and I think this will accomplish the task.

Thanks to everyone for all of your help.

like image 23
Doug Weaver Avatar answered Oct 19 '22 04:10

Doug Weaver