Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Internet Explorer The Internet Programming IT Technology

Plugging Internet Explorer's Leaks 480

jgwebber writes "If you're developing DHTML web apps, you probably already know first-hand that Internet Explorer has horrendous memory leak issues. You can't not run on IE, so you've got to find a way to plug those leaks. So I've created a tool to help you find them. So until Microsoft decides to fix its browser architecture (ha!), at least we can keep it from blowing huge amounts of memory."
This discussion has been archived. No new comments can be posted.

Plugging Internet Explorer's Leaks

Comments Filter:
  • How about firefox? (Score:5, Interesting)

    by moz25 ( 262020 ) on Friday June 03, 2005 @06:30AM (#12712478) Homepage
    Is such an approach also useable for finding firefox leaks? As a user (not developer, alas) I'm noticing that it invariably gets sluggish after some period of time, even with few pages open.
    • by madaxe42 ( 690151 ) on Friday June 03, 2005 @06:33AM (#12712489) Homepage
      I'm fairly certain there's a leak somewhere in teh FF javascript handler - I've noticed memory usage rocketing on some pages which use JS.
      • Is it not possible that there's a memory leak/hog in the javascript code on the particular page, or does javascript not work like that?
        • by Taladar ( 717494 )
          Without being too familar with Javascript I am reasonably sure Javascript uses Memory too like any other programming language on the planet.
          • by Sinus0idal ( 546109 ) on Friday June 03, 2005 @08:52AM (#12713007)
            Yes but like Java, Javascript surely uses a garbage collection concept meaning it is the browsers responsibility to free memory, and any leaks are thus due to the browser.
            • All this thread is kind of sensless, Javascript is as C,C++, Pascal, Java, etc a LANGUAGE, if the compiler/interpreter implementation is bad it is not the language fault, so if Javascript scripts get bloated in Fx it is because Firefox implementation of the JS interpreter is bad.

              It is like... saying that C programs are broken because they make core dumps...
              • It is like... saying that C programs are broken because they make core dumps...

                void main(void)
                {
                int *test;

                test = malloc(10);

                free(test);
                free(test);
                }

                Now, exactly how is it the COMPILER'S fault that the above program is going to dump core? I've rarely seen a core dump occur for any reason OTHER than because a C program is broken. It's very rarely a compiler issue.
              • In C you can malloc a ton of memory and then never free it, thus wasting memory. Garbage collecting languages do not require manual allocation/freeing.
            • Yes but like Java, Javascript surely uses a garbage collection concept meaning it is the browsers responsibility to free memory, and any leaks are thus due to the browser.

              Bubble bustin' time! Garbage collection doesn't always live up to its reputation. I have seen Java apps leak memory like a sieve. This one project I was working at would start up a production (!) EJB container in the morning, and by 13:00, it would have run out of memory and crashed. I told them to fix their leaks. When they got over

    • by Anonymous Coward

      Is such an approach also useable for finding firefox leaks?

      Doubtful. This is targeted at a very specific memory leak that Internet Explorer is known to have.

      As a user (not developer, alas) I'm noticing that it invariably gets sluggish after some period of time, even with few pages open.

      Apparently Firefox 1.1 will fix a lot of these memory leaks. You can try out "Deer Park" if you want a preview of Firefox 1.1.

    • I agree with you, I can not leave my computer with FireFox running for long time.

      Just yesterday I left my notebook turned on with firefox opened.

      After I returned 8 hours later I didnt payed attention and entered to some page with a flash game. Then I noticed my computer was very very slow, I pressed the ctrl-shft-esc to show the sysinternals proc. explorer and firefox was eating 99% of my CPU time and like 216 MB of memory (private bytes, the Virutal size was like in 300+MB).

      So if that happens when Fx is
    • by ssj_195 ( 827847 ) on Friday June 03, 2005 @06:50AM (#12712540)
      There were many, many leaks in Firefox, and many have been fixed for 1.1 (do a search on their Bugzilla for "memory leak"). Hopefully, the situation is now much-improved, but I suspect it will be the case that long periods of heavy-browsing will require you to to restart Firefox for quite a while yet. For this reason, I always recommend the Session Saver extension - makes closing and restarting Firefox less painful.

      Memory fragmentation is a big issue for modern desktop systems as the heap used by programs written in C/C++ can't be compacted, and most memory allocation systems weren't necessarily designed to support programs that would be continually allocating and deallocating memory for days on end. Robert Love gave a (fairly detailed and technical) talk on it at while back, with some suggestions for combating it on the Linux desktop, which I recommend to anyone who is interested. It's about 126MB, Ogg format.

      http://stream.fluendo.com/archive/6uadec/Robert_Lo ve_-_Optimizing_GNOME.ogg [fluendo.com]

      • So how does a managed environment with garbage collection like .NET improve this situation? Memory leaks should really be a thing of the past. Right? RIGHT!?
        • Memory fragmentation should, but there is always the risk of an errant part of your code holding references to an object which is no longer needed, possibly until the program is closed. The situation is much-improved with languages that have garbage collection as it is more automated and remove some of the burden from the programmer, but the problem of determining when an object will definitely never be used again by a program and thus making it eligible for garbage collection is in general only solvable b
    • Interesting as my firefox stays on 24/7 just like my thunderbird. It does not increase its memory usage either. Its on Linux though and is probably missing some of the famous plugins like macromedia and adobe pdf...
      • Thunderbird is absolutely horrendous on Windows. If I leave it on and don't touch it for 9-10 hours (a normal work day), when I try to do anything with it, it's like I'm trying to coax it to work on a 386. Most of the time I have to close it entirely and reopen it - the GUI may start responding again, but actually getting it to check email is impossible. I'll hit the check email button every 5 minutes for an hour and not have a single email, but as soon as I restart and check again, I have 10 emails.

        So
      • It most definitely affects Firefox on Linux, too. It depends a lot on your browser habits; the leak seems to get worse every time you open a tab i.e. closing a tab does not appear to free all of the memory that was allocated when it was opened, and this makes using Firefox with my personal usage pattern a nightmare :) I used Firefox fairly intensely under Linux last weekend, and eventually my 1/2GB of RAM and my 1/2GB of swap were all used up. Firefox had just ten tabs open at the time. The time taken to
        • Really? Weird. I use Firefox (in Linux) to open sometimes hundreds of tabs, on a machine with 256 MB of memory and a 5400 rpm 4 gig HD, and it works fine (viewing all the recent pictures on collegehumor). I also have had it open for weeks at a time without a problem. Same thing with Thunderbird, which I use at work (on Windows), it stays open as long as Windows stays up (which is usually a week or so). And I always have about 30 things running on my machine at work all the time.

          -Jesse
      • firefox 1.03 and OS X10.3 I could leave the browser running non-stop, for weeks.

        I upgraded to tiger 10.4 and firefox 1.03 and 1.04 both need restarts every other day. The system slows way down, with a spinning beach ball, but I can force quit it and restart in seconds to clean up the mess.

        I have been using safari but don't like how it deals with bookmarks.
    • Memory leaks don't cause sluggishness. Sluggishness is caused JS, flash players, chrome etc. all running on the same thread. Getting something like adblock is a good way to increase performance. These problems might not be so noticeable in IE since you can have multiple IE processes running at once.

      But Gecko does use something similar internally to IE called XPCOM. It's possible that some of the similar techniques that could track down memory issues in IE be adapted to work in Gecko. For example you can c

      • uh... okay. So if an app slowly creeps up in memory usage, going from 20 MB or so to over 100 MB, you don't think that'll have an affect on other apps? The other apps will have to rely on virtual memory instead of real memory. Computers 101.
        • No it doesn't affect other apps significantly. If an app leaks memory, that memory gets paged out because it is unused. It would be different if all those objects were in use causing page faults but they're not. It might say 100mb on the task list but the chances are that the amount of physical memory is significantly less than that. There would be some minimal system impact because paging implies disk activity and depending on the heap, not every leaky object is going to occupy exactly a full page on its o
        • What you just said has an intuitive appeal to it, but it's wrong.

          Memory lost to a memory leak is, by definition, not part of the resident set
          for the process and as such, is the most likely candidate to be
          swapped out to disk. Therefore, as long as you have swap space left on disk,
          other apps should not be noticeably effected.
  • by robojamie ( 883110 ) on Friday June 03, 2005 @06:32AM (#12712486)
    The true source of IE memory leaks?

    Korean outsourcing
  • here's something that helped [twinhelix.com] me with this recently:
  • by MaGGuN ( 630724 ) on Friday June 03, 2005 @06:40AM (#12712507)
    Everytime I try to download ten things firefox goes up to 300 megs of memory usage and 99% cpu usage. And I took the screenshots to prove it.

    Frankly, I think you can find problems and features you hate in most programs of a certain size, what matters is that you find the tool for the job that you consider the best match for your needs.
    • As I understand it, Firefox makes aggressive use of unused resources. If you're not having any slowdowns, then take a deep breath and realize that it's just doing what it's supposed to do.

      If you do have accompanying slowdowns, then you have a specific, rare problem. See the other replies you've gotten so far for suggestions.
    • Haven't noticed the memory issue, but i can confirm the cpu usage being 99%. In my case it was caused by an embedded Flash movie on the site. As soon as i closed that (or even rightclicked within the flash movie and choose 'stop' or whatever) things went back to normal.
    • Thanks for your comment! This has been driving me nuts. I installed firefox on various hardware, and on low and machines, it really really sucked. So I've been arguing for some time that the gecko engine (I notice the cpu-usage spikes as well) is really slow, compared to ie, opera or khtml. And always someone replied that he or she tried it, and it wasn't slow, like here [slashdot.org]. I had (and still have) little reason to doubt those comments, but they are run contrary to my own experience.

      Also, it's not on one machi

      • I've noticed Firefox (Windows) helping to peg the CPU when I'm doing something else on the PC when Firefox should be sitting idle in the background. It seems to compound any virus scanning activities or other file-access intensive apps like grep or gzip (Cygwin or native Windows compiled). My impression is that it's hooked into filesystem calls somehow, because if I close Firefox the other app goes much faster. I always close Firefox now before running disk-intensive tasks.

        I don't run it on Linux enough to
    • Everytime I try to download ten things firefox goes up to 300 megs of memory usage and 99% cpu usage.

      I'm always fascinated when people get upset that a particular application uses a large amount of memory or CPU cycles. It really doesn't do you any good when your computer is in an idle state -- you're eating energy and doing nothing. If I was never supposed to use 300M of RAM, then why did I buy a 512M stick? What good is my fancy whizz-bang processor if it's looping through no-ops 99% of the time?

      O

  • best plug for it (Score:2, Informative)

    by sl4shd0rk ( 755837 )
    would be sealing it in a cement box and chaining the lid shut. I cannot believe that after all the
    vulnerabilities, bad experiences, and poignant advice, people still continue to use it.
    The alternatives aint perfect but they are a hell of a lot better.

    "Microsoft Internet Explorer 6.x with all vendor patches installed and all vendor workarounds applied, is currently affected by one or more Secunia advisories rated Highly critical" ...

    "Currently, 20 out of 81 Secunia advisories, is marked as "Unpatched" in
  • Actually, it's very easy to make a site not run on IE; as the following example shows.

    <?
    if (preg_match("/MSIE/i", $_SERVER["HTTP_USER_AGENT"])) {
    header("Location: http://www.mozilla.org/products/firefox/");
    exit();
    };
    ?>
    <html>
    <head>
    <title>This site will not display in Internet Explorer</title>
    .
    .
    .
    </head>
    <body>
    .
    .
    .
    </body>
    </html>
    • Don't be an @$$. Remember how annoying it was when people said that sites only displayed right in IE 5.5 or "better"? Yeah, you do. Did that get you to use IE? No, it didn't, unless it was your bank or something. So guess what? 90% of people won't go to your non-IE site. Period.
      • If the web designer is willing to go to the effort of excluding +-90% of browsers, the site probably isn't worth viewing anyway.
        • Depends. If some book excludes 90%+ of readership based on some required knowledge it may still be worth reading. Like if it is some academic publication. If your site deals with... uhm, web-design or security issues you may well wish that people do the first step to continue reading. Plus - you have it wrong, it may not be "to go to the effort of excluding" but to "save the effort" of supporting not-quite-up-to-date browser technology.
        • Or it's a niche site.

          The niches I can name outright include:

          • corporate intrawebs
          • highly-technical sites for non-MS environments
          • addons.mozilla.org
          For the first, the corporate policy forbids IE anyway. For the second, I don't expect kernel developers or KDE guys to come from a Windows platform. And for the third, what's the point?
    • if you make links that contain '\'-s. IE will convert them to '/'-s and the webserver will convert the links to 404.

      Szo
  • Don't Bother (Score:4, Insightful)

    by FellowConspirator ( 882908 ) on Friday June 03, 2005 @06:59AM (#12712561)
    If you work around a problem, it hides from the user that the problem exists. The demand to have it fixed, therefore, dissipates and developers accept the onus to repeat work-arounds everytime they deploy something. Ultimately, the browser fails to improve, and the costs of errors are passed from the vendor (Microsoft) who never fixes the problem to the public (developers that waste time with work-arounds).

    Anyway, if you write things specifically for IE -- then you've already got a more serious problem that you have to address first. There's no excuse for what you already know to be dismal practice.
    • So ... what you're suggesting is that people write webpages for IE, that don't crash is as such, but cause it to leak even more than usual, causing more and more people to be pissed off by it's horrible design?
    • " If you work around a problem, it hides from the user that the problem exists."

      This is VERY true.

      Which is why on my site [bowlie.com] I purposefully avoid giving a hoot that IE can't display PNG's properly.

      When I tell people to use Firefox, it's an added sense of wonder when they do and see that suddenly the images don't have grey backgrounds after all. It also helps hammer home just how cruddy the software (IE + Windows... it is an integral part of the OS afterall) that they were using actually is.

      It's the s

    • After all, people haven't been working around these problems so far, which caused customers to complain and Microsoft to fix these problems- which is why Internet Explorer doesn't have any leaks any more!
  • I wonder if the upcoming IE7 will even fix these existing memory leaks.
  • Please keep up the good work and maybe Microsoft will buy you. Or do we need to revert back to using netscape?
  • I am working on a farly large asynchronous web app and , well memory leaks are the norm, I am by session end , usaually an hour, consuming some 125 meg for the IE instance.

    I will be using this on a regular basis. COOL Stuff at first glance, very cool....
  • RTFA (Score:2, Informative)

    by Anonymous Coward
    If any of you would RTFA, you'd find that the tool doesn't address leaks in Internet Explorer: It identifies web page code that cause leaks because the developer coded poorly. It doesn't matter what browser you use, people can still write web pages that will cause it to leak memory...
    • Re:RTFA (Score:3, Informative)

      by jhurshman ( 722388 )

      Not exactly.

      It detects memory leaks that are due to the two separate garbage collection routines that IE employs for DOM objects on the one hand, and JavaScript objects on the other. The leaks occur when a developer creates a circular reference between a JavaScript object and a DOM object, which is a very easy and natural thing to do.

      For example, this creates a memory leak in IE:

      someNode.onmouseover = function() { this.style.color = "#f00" };

      That is "poor" code only in the sense that it trips over

    • Re:RTFA (Score:4, Insightful)

      by shumacher ( 199043 ) on Friday June 03, 2005 @11:15AM (#12714139)
      While I don't think MSIE is inherently evil, I think I could argue that a browser that allows web pages (a resource that should not be trusted) to cause memory leaks is itself flawed. Part of the browser's job is to not expose the user to risk or instability while interpreting documents of unknown maliciousness and quality.
  • I so wish that Mozilla ActiveX control were really ready to be drop-in replacement for MSIE ActiveX. So far it has issues that prevent this from happening (for once, tab key does not work in forms out of the box, or printing issues). I know that there are (probably) workarounds for those somewhere around but I'm just not all too ready to seek for those. Also - ActiveX for embedding Opera would be nice.

    Reasoning: I find that most of the apps I've been working on can benefit greatly from being done mostly in
  • by Anonymous Coward on Friday June 03, 2005 @07:47AM (#12712693)
    It seems to me people are now attacking IE now from 3 major angles:

    • Memory and resource usage
    • Rendering and adhering to web standards
    • Security

    IMHO, It's laughable to mock IE for memory leaks when Firefox is X (where X > 1) times worse at sucking up and retaining memory.

    People have relentlessly said the reason IE is faster to load than IE on Win32 is because it is "embedded into the OS" and somehow brushed off this advantage in favour of it's debateable disadvantage in terms of security. What's next? Will slashdotters crying out something along the lines of "WOW! IE, an embedded part of the Windows, has memory leaks! What does that say for the Operating System? You better use Linux!"?

    IE may be guilty of having a buggy implementation of web standards such as CSS2.1 but during the browser wars wasn't it IE producing functionality that hadn't even been drafted by the W3C yet?

    Isn't that "Internet Explorer's architecture made this app fairly easy to build." as testament to the browser?

    This tool is interesing and useful for developers and I thank jgwebber for writing it as I'm sure it'll be useful even to lowly personal developers like me.
    On the other hand i'm a bit baffled as to why this article wasn't simply written as "Hey IE has memory leaks, checkout this new tool [blogspot.com] by jgwebber and see for youself. Let's discuss how sucky Internet Explorer is and cover up all the flaws in competitor browsers".

    It would have had the same effect as CowboyNeal's unnecessary "(ha!)"'s and claims of IE's "horrendous memory leak issues" without a link giving some evidence for these claims for those of us without first-hand DHTML development experience.

    I truly wasn't aware of any serious IE memory leaks..i'm going to, go off and Google for information now using the cumbersome Firefox. Any links would be much appreciated since CowboyNeal didn't bother.
    • by lseltzer ( 311306 ) on Friday June 03, 2005 @08:28AM (#12712884)
      >>It's laughable to mock IE for memory leaks when Firefox is X (where X > 1) times worse at sucking up and retaining memory.

      Thanks, I'm glad someone pointed this out. My system has been up for many days now and IE and Firefox are both consuming about the same amount (90-something MB).
    • If there exists Product X with an issue, and all of its competitors have the same issue, you can't just declare it moot. MSIE has memory leaks, sucks to be them. Firefox has memory leaks, sucks to be them. How about Lynx and Opera? Do they both have memory leaks just as significant? If they don't, I hardly think they'd appreciate you deciding that it doesn't matter since both IE and Firefox have them.

      In conclusion, IE has memory leaks. Nya nya.
    • I truly wasn't aware of any serious IE memory leaks..

      You soon will... Even if jgwebber had the best of intentions when he wrote the tools (help Web developers write their javascript in such a way as too be easy on IE's leaky memory manager), I'm quite sure that is not what it will be used for in most cases. Quite the contrary! How long until we'll see a new flurry of "worst viewed with Internet Exploder" sites that throw your PC into a swap orgy seconds after they opened up and showed you their obgoats?

    • by toby ( 759 ) on Friday June 03, 2005 @09:34AM (#12713305) Homepage Journal
      during the browser wars wasn't it IE producing functionality that hadn't even been drafted by the W3C yet?

      You say that like it's a good thing(!)

      "Internet Explorer's architecture made this app fairly easy to build." as testament to the browser?

      No; for some pretty obvious reasons: one obvious one being, you exclude anyone not using that particular browser. I thought everyone realised that was a Bad Thing - or maybe you haven't been one of those people who can't use their online bank because the bank decided to arbitrarily depend on IE. One can only hope that accessibility laws will put an end to such stupidities.

      It's not surprising that both browser products have memory leaks. However one could reflect deeply on the differences in responsibility and approaches to remediation. In Firefox's case - being open source - you have complete transparency; you can file a bug on it, check the bug db, or even fix it yourself (don't laugh). In M$'s case, all you can do is kiss your money goodbye and hope they fix it "one day".

      The same goes for all the rest of their system, too. It is not always obvious what a disturbing abdication of rights using a closed system is. A friend recently told me of a Visual $tudio crash triggered by a few \b backspace characters in a print statement. Not such a big deal, I thought at the time; but I found myself reflecting on his story later. Eventually the true horror of the situation sank in, which is that we have to completely trust the ability and goodwill of the vendor to deal with any and all issues in their O/S. That is no small responsibility and there is not much evidence that M$ is capable of fulfilling their end of the bargain. I would postulate, after RMS of course, that no closed and proprietary system on the scale of M$ products can be adequately maintained by one vendor. And of course maintenance becomes irrelevant when major "rewrites" are involved, such as have been prescribed by Longhr0n to fix W1ndows' fundamental ills (ref Spolsky on rewrites, Things You Should Never Do [joelonsoftware.com]).

      The thought that one has no recourse and indeed not even any way to inspect the system one uses (livelihood, etc), is deeply, deeply disturbing, and I again have to thank RMS for pointing out long ago [gnu.org] what a dead-end that is, and for putting in place viable alternatives.

    • We have a kiosk running an html application in IE6. It uses lots of javascript and the front page reloads every couple minutes when idle. It's been running for 6 months on 64mb of ram with no issues. The same browser window has been open all that time.

      I remember one time writing a page which by accident, hit a memory leak in Mozilla (before there was a FireFox) which consumed about 1mb of ram a second. All the page did was draw a bouncing line, by creating a div for every line pixel of every frame and disp
    • but during the browser wars wasn't it IE producing functionality that hadn't even been drafted by the W3C yet?

      Yes, and that was the whole damn problem.

      The point of HTML was universal interoperability (so Tim Berners-Lee's collegues could all read each other's stuff no matter what computer setup they had). But Microsoft sacrificed this in order to obtain control and market share. They encouraged web developers to use their proprietary markup, which forced people into using their browser if they wanted to access this content.

      This was not a benevolent gesture from Microsoft- it was nothing but a power-grab. Open, agreed-upon standards are the foundation of interoperability, and Microsoft always stands against this when it thinks it can monopolize a technology.

  • I have a problem having someone check my code who can't spell or use proper grammer. A swift click on a spell checker sure would add a lot of credibility to some whois telling you their code will check your's for it's grammer and spelling.
  • Would we have the same basic post. Would we have it at all?

    The post would be more like.

    "Firefox has some basic issue releasing memory in certain scenarios involving DHTML. Recently a tool has been released to help alleviate the problem until the problems are fixed."

    Do we have to act like children around here. It is a software program, not a brutal dictator.

    • ...that once Microsoft decided that it had the browser game all wrapped up it Disbanded the Internet Explorer team. This meant that a lot of long standing bugs are still present in the product, but hey, that really doesn't matter since 99% of people will still use it for years to come.

      Now that Microsoft has seen that Firefox could take their proprietary lock-in away they are starting development again.

      The thing is, Firefox does have memory leaks, but they are actively fixing them...can the same be said

      • that really doesn't matter since 99% of people will still use it for years to come

        I don't know. Norway's most popular online newspaper (vg.no) today released fresh log analyses showing that only 86% of their visitors are IE users (compared to 95% one year ago). 8% use Firefox, and 5% use Opera. That may just be crazy Norwegians, though. I'd sure like to see what the numbers are for Slashdot.
  • great idea (Score:4, Informative)

    by Trailer Trash ( 60756 ) on Friday June 03, 2005 @10:47AM (#12713888) Homepage
    But your inflammatory tone would be really cool if our open source alternative in Firefox were somehow better. Right now, Firefox is using 373M on my computer (334M resident) with three windows open, none of which have anything bigger than this /. page. Mozilla is using 279M (I'm also running it) with a single page open. Firefox usually gets up to around 600-700M over the course of 3 or 4 days, after which it generally just dies. Otherwise, I have to kill it due to its slowness.

    Why not leave IE to Microsoft; put your effort toward something you can actually fix rather than being an ankle-biting ass.

I tell them to turn to the study of mathematics, for it is only there that they might escape the lusts of the flesh. -- Thomas Mann, "The Magic Mountain"

Working...