Slashdot Mirror


Firefox Working to Fix Memory Leaks

Christopher Blanc writes "Many Mozilla community members, including both volunteers and Mozilla Corporation employees, have been helping to reduce Firefox's memory usage and fix memory leak bugs lately. Hopefully, the result of this effort will be that Firefox 3 uses less memory than Firefox 2 did, especially after it has been used for several hours." Here's hoping. Frequent restarts of things on my computer make me furious. I can't imagine why anyone would tolerate such things.

555 comments

  1. about time! by downix · · Score: 4, Insightful

    Too many apps nowadays just throw out RAM like it was yesterdays newspaper! It is sloppy coding, and I'm tired of having to put 2GB of RAM into a system just to surf the net nowadays.

    --
    Karma Whoring for Fun and Profit.
    1. Re:about time! by tritonman · · Score: 2, Informative

      Half the time when I start having memory problems on my PC, I look at firefox (which is just has one tab open with yahoo mail) and it is using like 400 megs of RAM.

    2. Re:about time! by Anonymous Coward · · Score: 0

      Apps do a lot more nowadays than yestercentury's apps. I once had a discussion about a read buffer that I used to speed up network reads. I used a megabyte just for reading in a configuration file, which a colleague found incredibly wasteful. Well, I countered that I could read the file with much less memory, but then it would be slower under some circumstances, and on most systems allocating 1 megabyte for a couple of seconds is simply no problem. I've written whole applications for machines which didn't have enough memory to hold one of today's truecolor icons. It's not a matter of can or can't do. If the machine has enough RAM, it is wasteful to let it go unused if the application can benefit from using more RAM.

    3. Re:about time! by DustyShadow · · Score: 1

      I consistently open 10-20 tabs in Firefox and it hardly ever gets over 250 MB of RAM use. I think that's acceptable. I have other beefs with Firefox, such as the PDF crash issue (Maybe this is an adobe problem, I don't know.) and other random crashes that have been happening lately. There was just a recent update though so maybe the random crashing will stop.

    4. Re:about time! by MightyMartian · · Score: 1

      Apps do a lot more nowadays than yestercentury's apps. I once had a discussion about a read buffer that I used to speed up network reads. I used a megabyte just for reading in a configuration file, which a colleague found incredibly wasteful. Well, I countered that I could read the file with much less memory, but then it would be slower under some circumstances, and on most systems allocating 1 megabyte for a couple of seconds is simply no problem. I've written whole applications for machines which didn't have enough memory to hold one of today's truecolor icons. It's not a matter of can or can't do. If the machine has enough RAM, it is wasteful to let it go unused if the application can benefit from using more RAM.


      Yeah, after all, it's not like there are any other applications running on the computer.
      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    5. Re:about time! by jandrese · · Score: 1

      Yeah, but think of the people who are running Firefox on a 265MB machine, with XP. I find on XP machines with a GB of RAM, Firefox leaks slowly enough that I never really notice it, and I've been known to leave it open for days. The only things that kill it are the occasional animated GIF that for some reason sucks down all of the cpu cycles on my box and drags Firefox to a crawl and flash plugin crashes (which are rare thanks to flashblock).

      --

      I read the internet for the articles.
    6. Re:about time! by Rei · · Score: 1

      Or like anyone ever uses older computers any more. Try running a modern KDE on a computer that has 96 megs of ram or less.

      On older computers, it's not processor speed that'll get you. You can always disable special effects and the like. It's the ram. You can't disable enough components to reduce the memory footprint significantly. What the problem really comes down to is test cases. Most developers are developing on modern systems where they don't have other applications running that could eat up memory. Their development practices are biased by this fact. I'm willing to let game developers slide on being memory hogs by virtue of the fact that modern games require modern computers, games are driven by tight performance requirements, and there's generally little multitasking with other applications when gaming. But things like web browsers have no excuse for wasting memory.

      I use Konqueror most of the time, despite it not being as widely supported by websites as Firefox. Why? It's relatively lightweight. It starts in seconds, and usually has a fraction of the memory footprint. If a website is problematic in Konqueror, sure, I'll bring up Firefox. But I don't like to.

      --
      Ever since, I've been suspicious of Jesus and very careful around chlorine.
    7. Re:about time! by lazy-ninja · · Score: 1

      Solution to the PDF issue:

      http://www.foxitsoftware.com/downloads/

    8. Re:about time! by icepick72 · · Score: 1

      You're tired of progress? You want everything to be like a couple of old apps you used to have that were rock solid? You should get into programming and see the software world as it stands right now. But everything you said sounds good in theory. It always did in the past and it always will in the future.

    9. Re:about time! by crustymonkey · · Score: 1

      Or like anyone ever uses older computers any more. Try running a modern KDE on a computer that has 96 megs of ram or less.

      Ok, anyone trying to do that is just stupid. Really, the KDE devs make no bones about the fact that it is a larger, more "lumbering" behemoth of desktop environment. If you want a desktop running on an ancient computer, don't use KDE. Use ICE or fluxbox. To complain that something is bloated because it's not "snappy" on a 15 year old computer is just ridiculous. If you want to run modern applications, use at least semi-modern hardware.

      I will however agree that Firefox is rapidly moving towards nearly unusable monster at this point. I do agree that a browser should not be chewing up 250MB of RAM to display 10 or so web pages.

      --
      \033:wq!
    10. Re:about time! by Threni · · Score: 1

      > I'm tired of having to put 2GB of RAM into a system just to surf the net nowadays.

      You've only got to do it once! Are you sure you plugged it in properly?

    11. Re:about time! by lazy-ninja · · Score: 1

      unlocking firefox is great. But foxit will actually open PDFs ^_^ (and faster)

    12. Re:about time! by Jeffrey+Baker · · Score: 1, Troll

      And incorrectly. Among foxit's many, numerous bugs is the inability to correctly number the pages, which makes it pretty fucking hard to discuss the document with someone who uses foxit, because eventually you will say "It's on page 8" and they will say "page 8 is blank!" and then you will find out that they use foxit and then you will just have to stop talking to them or possibly beat them to a bloody pulp for wasting so much of your time.

      Not that I'm bitter. I'm just really tired of people saying "XYZ is faster than ABC" when the reason XYZ is faster is because it does half of everything incorrectly.

    13. Re:about time! by tepples · · Score: 1

      You've only got to do it once! For each machine. Out of millions.
    14. Re:about time! by G-funk · · Score: 1

      Well whatever the reason, you're both lucky and an unusual case. Firefox leaks ram like a sieve. At the moment (I restarted it yesterday), it's using 1.58gb of virtual ram, and 307mb of real ram. Firefox is the operating environment. If it's possible for plugins to bring the thing down, then there's a problem with that operating environment.

      --
      Send lawyers, guns, and money!
    15. Re:about time! by Anonymous Coward · · Score: 0

      It really makes you wish Opera marketed themselves better. Cause that's the only important thing they missed in this race.

    16. Re:about time! by Rei · · Score: 1

      Yeah, that's easy to say "use ICE or fluxbox" to someone who has lots of experience with Linux.

      Now tell that to someone who can barely use Windows. That's who I was installing for.

      There's little excuse for deliberately making something "a larger, more lumbering behemoth".

      --
      Ever since, I've been suspicious of Jesus and very careful around chlorine.
  2. Bloat in general by pipatron · · Score: 5, Insightful

    I don't mind the memory. I have plenty of gigs even in my laptop. What I mind is the general slowness that I experience with Firefox, and that makes me use Opera on my laptop even though I would feel better using an open source browser.

    --
    c++; /* this makes c bigger but returns the old value */
    1. Re:Bloat in general by kc2keo · · Score: 1

      I use firefox2.0.0.7 every day in Ubuntu Fiesty Fawn (also in Windows when I game) and have it running with 5 or more tabs at all times i'm using the computer. I also have it set so when I start firefox up all my previous tabs open up. Sometimes I get a browser crash.

      However... when I used Firefox1x I noticed everything was snappier. With firefox 2x I felt my browsing experience was getting sluggish with the new Firefox series. I am all for a more efficient browsing experience. A faster browsing experience is very important for users just trying out the browser.

      Thats just my 2 cents... I know my grammer sucks and this will never get modded insightful.... :-(

    2. Re:Bloat in general by Anonymous Coward · · Score: 0

      your spelling also sucks if its any consolation.

    3. Re:Bloat in general by ShatteredArm · · Score: 1

      Why would you "feel better" using an "open source" browser? Is Mozilla more deserving of our patronage simply because of that "open source" label? I think one could argue that some of Firefox's problems are because it is open-source, and some of Opera's strengths are because there is a well-managed team of paid developers working on it. I don't have any qualms whatsoever with using Opera just because it's not open-source, and I don't have any issues saying some particular piece of software is better, even if it is proprietary and closed-source.

    4. Re:Bloat in general by pipatron · · Score: 1

      Because I have no clue what Opera does under the hood. At the moment, I'm quite sure it's not doing anything 'bad', because I trust the opera guys. This might change any moment, since the door is closed, so to say. You have to put the trust in the hands of the developers. That's why I'd prefer to use free software.

      --
      c++; /* this makes c bigger but returns the old value */
    5. Re:Bloat in general by mattgreen · · Score: 1, Insightful

      Have you personally audited every line of the Firefox codebase?

    6. Re:Bloat in general by ShatteredArm · · Score: 1

      I think there are laws out there to prevent the Opera developers from doing anything "bad", plus they have public opinion motivating them from doing anything terrible. I actually can't say I trust them any less than the folks at Mozilla. Who's to say Mozilla's not doing anything bad? Yeah, the source code is available, but who outside of their development team is familiar with it and knows how each module works? I get the whole transparency thing about open source projects, but if it gets so huge that nobody with any kind of life outside of internet browsers can monitor it, that transparency is really just an illusion (Har!). I think a closed-source project is just fine, as long as accountability is there, and Opera is small enough that public opinion can hold them accountable perfectly well.

    7. Re:Bloat in general by tknd · · Score: 2, Insightful

      I agree! Except I can't fully blame firefox. I also have a lot of blame on websites and the direction some sites have gone. Take for instance, slashdot and even more annoying digg. The weight of the website has gotten considerably higher for no good purpose other than to look better. I can't argue against looks. Looks sell. But on the other hand it hinders the general experience as websites keep adding more and more layers making the browser's job more and more complex. Websites and website developers are equally responsible for degradation of performance of the web.

      I'm not sure the problem or tension will ever be resolved either. Web developers always want to offer the next new fancy feature and browsers will always be one (or a few) step(s) behind implementing the next spec. The result is a tool pushed beyond its original intentions at the cost of performance.

    8. Re:Bloat in general by Nicolay77 · · Score: 1

      I think your argument is true in general. That is, if we are talking about all closed source ever written vs. all open source code ever written.

      However, in this particular case it seems to be very wrong. Opera is a much finer browser than Firefox, even with all the might of Google marketing behind Firefox. This is simply because Opera has nothing to gain doing dubious stuff, and a lot to lose, as it has a huge target market with lots of information about Opera and competitors. In fact I think that closed source is not an issue with mainstream software.

      Your 'this may change in any moment' comment has no weight.

      I can concede that, in most vertical software, the closed source versions are generally evil. Browsers in general, and Opera in particular are not vertical software.

      --
      We are Turing O-Machines. The Oracle is out there.
    9. Re:Bloat in general by pipatron · · Score: 1

      this may change in any moment

      Well, what I meant with this is for example if Opera would sell the browser to someone else. I would of course still be able to use the old version, unless their license prohibit me to do so (I haven't read it!), or then switch to some other browser.

      Like uTorrent, a previously great torrent client for Windows. People occasionally whined that the source was closed. Eventually uTorrent was sold to the bittorrent company, and the newer versions started to send mysterious packets back to them...

      As I said. For now, I have no reason not to trust Opera, so I use it.

      --
      c++; /* this makes c bigger but returns the old value */
    10. Re:Bloat in general by Apreche · · Score: 1

      I also don't mind the memory usage if it means we can eliminate the crashing and the slowness. I started using Phoenix(take that!) originally because it was light, fast, and minimalist, but it had the tab feature to make browsing more efficient.

      --
      The GeekNights podcast is going strong. Listen!
    11. Re:Bloat in general by blockhouse · · Score: 1

      Exactly! The fast, minimalist outlook was the guiding philosophy behind the development of Phoenix/Firebird, and that's what originally attracted me to it. I think this philosophy was lost about the time of the name change to Firefox, and it's been all downhill since then. We've come a long way with the increasing memory and cpu burdens posed by feature creep and "must-have" plugins, themes, etc. Phoenix/Firefox worked fast and well. Yes, I don't remember it doing much in the way of Flash, Java, JavaScript, eye candy etc. But when I needed those things, I fired up Mozilla suite/Seamonkey.

      It'd be nice if someone made a minimalist, fast alternative to Firefox, just as Phoenix was the minimalist, fast alternative to Mozilla suite. Something like Lynx, with graphics.

    12. Re:Bloat in general by sepluv · · Score: 1

      Use links2 -g (that's graphical Links with images). That's what I do when I need to do something quickly that doesn't require heavy JS and the thousands of open tabs in Firefox are slowing it down quite a bit. Apparently you even get tabbed graphical browsing if you use links-hacked but I haven't tried that yet.

      On DSL, I never experience pages loading at all with links (as the split second between my clicking a link or pressing return and the page loading doesn't mentally register).

      --
      Joe Llywelyn Griffith Blakesley
      [This post is in the public domain (copyright-free) unless otherwise stated]
    13. Re:Bloat in general by Nicolay77 · · Score: 1

      AFAIK they have refused to sell to MS or other big companies several times.

      --
      We are Turing O-Machines. The Oracle is out there.
    14. Re:Bloat in general by Sancho · · Score: 1

      I like Opera quite a bit, but it has enough quirks that I don't use it for everything.

      * Periodically (and not consistently reproduceably) Google Reader flips out. I can see one headline of one article, but the story and all other headlines are lost.

      * Plugins are a nasty hack. No one writes plugins for /Opera/, they write them for /Firefox/ so they have to use a wrapper. I wish they'd do more work on this.

      * Plugins can't capture user input, so if I'm playing a Flash game in Opera, and the whole webpage doesn't fit on one screen, then using the arrow keys will send the input to both Opera and to the Flash game. The webpage scrolls at the same time that the Flash game is receiving the input.

      * Managing per-site preferences takes forever (load times, mostly). This wouldn't be too big of a deal if Opera had better extensibility (mostly, I want to be able to enable cookies, Javascript, and plugins on a per-site basis.)

      None of these alone are showstoppers, but I do find myself using Firefox more and more, despite the bloat, because more and more websites require Java, Flash, cookies, etc, which is a whole separate level of annoyance.

    15. Re:Bloat in general by Nicolay77 · · Score: 1

      I consider all of what you say, bugs.
      That is, I don't think anybody in Opera has deliberately tried to make the browser malfunction as the GP tries to imply.
      Instead they are working overtime to try to fix the plugin stuff. Preferences load and save very fast in 9.5.

      In this regard, Firefox also has a lot of bugs, and they are also trying to fix them.

      In my case I use Safari for windows when some flash doesn't work well in Opera.

      --
      We are Turing O-Machines. The Oracle is out there.
    16. Re:Bloat in general by Sancho · · Score: 1
      They may all be bugs, but they're still annoying, and when they inhibit usability, they force me to go to another browser. Hopefully 9.5 will be better.

      In my case I use Safari for windows when some flash doesn't work well in Opera. Not an option for Linux users like me.
    17. Re:Bloat in general by mcvos · · Score: 1

      Because I have no clue what Opera does under the hood.

      I have no clue what Firefox does under the hood. Now I'm sure the Mozilla folk are all great people, but I think the same is true of the Opera people. Were everything else the same, I'd choose open source over closed source every time, but in the end, I want good software most of all, and Opera seems to be nowhere near as leaky as Firefox.

      Now I still use Firefox for most of my browsing, and especially for testing and debugging websites, there's simply no allternative (although firefox still doesn't render XML properly), but I really should be using Opera for all my regular browsing. But I hope Firefox succeeds in bringing its memory footprint down to more reasonable levels. Because I really do want to support it if at all possible.

  3. And on three... by onetwentyone · · Score: 0, Redundant

    Cue it's not a bug it's a feature. GO!

    1. Re:And on three... by Selfbain · · Score: 5, Funny

      Ok.

      --
      Well, it has never been successfully tested.
    2. Re:And on three... by moore.dustin · · Score: 1

      Actually... it kinda is :)

      This is long overdue and is the cause of my biggest gripe with Firefox. Without a couple vital extensions related to my work, I would have ditched FF for IE7 because of this issue. I absolutely hate having to Force quit the .exe in order to save my session tabs and free up the memory. Every single machine I use (3 desktops, 1 laptop) has to be forced down on a nearly daily basis if not more, in order to keep the memory available for other applications.

    3. Re:And on three... by Seumas · · Score: 5, Interesting

      Actually, from what I understood over the last year "THERE IS NO MEMORY PROBLEM".

      Every time someone mentions memory issues, the responses are either that it's supposed to consume a gigabyte of ram so that it speeds up the back button or that "there is no memory issue".

      Strange, now, that there are suddenly people paying attention to specifically attacking memory use issues that supposedly don't exist.

    4. Re:And on three... by Burpmaster · · Score: 1

      I absolutely hate having to Force quit the .exe in order to save my session tabs and free up the memory.

      On that note, Firefox 3 now asks if you want to save your session when you choose quit out of the file menu, or when you close the last window with multiple tabs open.

    5. Re:And on three... by morgan_greywolf · · Score: 2, Funny

      Actually, from what I understood over the last year "THERE IS NO MEMORY PROBLEM".

      Every time someone mentions memory issues, the responses are either that it's supposed to consume a gigabyte of ram so that it speeds up the back button or that "there is no memory issue". This technique seems to be working for Microsoft. "THERE ARE NO MORE SECURITY PROBLEMS IN WINDOWS." Hey, maybe that's what the Microsoft developers visiting with the Mozilla developers last year was all about...

    6. Re:And on three... by Anonymous Coward · · Score: 0

      Worst I ever had was firefox consuming about 3GB of ram. This was with caching on firefox turned down as much as possible. Admittedly I had two windows and about 80 tabs open, but when i killed it and restarted it it only took about 512MB.

    7. Re:And on three... by TheRaven64 · · Score: 1

      It's a step in the right direction, but it's still a bad UI. A good UI should not ask for permission for anything that can be undone. It should automatically save the session, and then give you an option of reopening it the next time you launch. Safari 3 does this, although it hides the reopen function in the History menu, and doesn't save the back-history for each tab (irritating). Restarting it every few days keeps memory consumption sensible (I just restarted it, and it went from 400MB to 70MB). There's no conceptual reason why the browser couldn't detect that it's not active, has been running for a few days, and hasn't been active for a few minutes (or hours) and automatically restart itself periodically. Think of it as a very coarse-grained version of garbage collection.

      --
      I am TheRaven on Soylent News
    8. Re:And on three... by Anonymous Coward · · Score: 0

      You must be doing something seriously wrong with your firefox. I have been running mine since my last system patch (according to uptime, that is 24 days), with an average of 7 tabs, and I am using 123 MB of memory. As a comparison. I am running Opera with 6 open tabs and it is using 164 MB of memory. They are both on (and have only visited) the same types of sites (/., you tube, google, ebay, local tests/routers, etc). Pretty soon, Opera (which I started today) will go into its busy loop and I will have to restart it, but firefox will probably continue running like a champ for weeks (I say probably, because yes, I have seen it fall over, not nearly as often as Opera, Safari, and IE, but it does happen).

      Under preferences main you should select When Firefox starts: Show my windows and tabs from last time. No need to force quit to get it automatically. This option is at least available in 2.0.0.7 in mac os and linux.

    9. Re:And on three... by moore.dustin · · Score: 1

      If I am doing something serious wrong with my Firefox, then it is not my fault. I am using the browser no differently then thousands and thousands of other users. I visit dozens of websites a day, opening and closing tabs regularly while online. That simple use causes the memory to run rampant. Maybe it is the extensions, either way, FF should not allow an extension to compromise the integrity of the memory allocation on my machine. That is assuming an extension is the main issue. I do not believe to be true since I have a cocktail of extensions on this machine while my laptop has only a few, yet both have the same performance issues. I have one machine with a clean and updated FF install, no extensions, and I still see this problem, though not as often since it does not see regular use compared to my other machines.

    10. Re:And on three... by Anonymous Coward · · Score: 0

      oh shut up you stupid fucking cunt. firefox takes about 25 megs when you start up. YOU SPASTIC TROLL.

    11. Re:And on three... by Burpmaster · · Score: 1

      In this case, I think it's a good idea to warn the user before saving the session. The user may not know about the feature, and Firefox might later be opened by someone else. If you want it to save the session without asking, choose the 'always do this' option and then 'save and quit'.

    12. Re:And on three... by Anonymous Coward · · Score: 0

      I think he meant he restarted with the 80 tabs reloading, dumbass.

    13. Re:And on three... by vidarh · · Score: 1
      Saving and reopening in Firefox 2 at least is not something I want to do often, as it acts as if you reload all the pages in all the tabs.

      On a lot of the sites I tend to have tabs open on, my sessions will have expired, and the tabs are pointless if I restart the browser. If Firefox did that automatically it would make the frequent restarts (I tend to restart a couple of times a day - when Firefox reaches 1.5GB to 2GB of memory on my Macbook Pro) even more painful.

    14. Re:And on three... by Bandman · · Score: 1

      You can't forget "yea, but what extensions do you have installed?"

    15. Re:And on three... by Tim+C · · Score: 1

      It should automatically save the session, and then give you an option of reopening it the next time you launch.

      No thank you - that will make it two clicks for me to start FF rather than 1, as even when it has crashed I sometimes choose not to restore the previous session.

      There's no conceptual reason why the browser couldn't detect that it's not active, has been running for a few days, and hasn't been active for a few minutes (or hours) and automatically restart itself periodically.

      Funnily enough, I was talking about exactly this last week with one of our sysadmins at work, about a particular problematic server. We agreed that doing that sort of thing is the absolute last resort; it is an admission of defeat, that you don't know what the cause of the problem is or how to fix it, so you're just going to restart the damn thing every so often to stop it from happening when someone's actually trying to use it.

      With something like this, it's even worse - odds are every so often the damn thing would restart just as you were about to use it.

    16. Re:And on three... by FutureDomain · · Score: 1

      I absolutely hate having to Force quit the .exe in order to save my session tabs and free up the memory.

      You don't have to force quit Firefox to save your tabs. Just set it to open "My windows and tabs from last time" as the startup option. Your tabs will be automatically saved when you close Firefox. I find too many people abusing the crash recovery system just to save their tabs, when setting a simple option on the first options page will do what they want.

      --
      Hydraulic pizza oven!! Guided missile! Herring sandwich! Styrofoam! Jayne Mansfield! Aluminum siding! Borax!
    17. Re:And on three... by Anonymous Coward · · Score: 0

      Firefox running for about 24 hours:
      286408 132936 tty1 Sl Sep24 31:55 /usr/lib/mozilla-firefox/firefox-bin

      Forefox running for 24 seconds:
      191860 54232 tty1 Sl 16:35 0:06 /usr/lib/mozilla-firefox/firefox-bin

      I find that if I leave it running for a week or so, it'll let itself grow up to 500-600 megs with all but my current tab closed. It's the only app I use that never seems to give memory back to the system and due to that, it's the only app I ever need to restart. The best part is almost none of that 5-600 megs is actually in RAM, most of it is swapped out and never used, causing a good 30-60 seconds of swap (and 100% CPU utilization for that time on one processor of my MP system).

  4. Here we go... by Anonymous Coward · · Score: 0

    The bulk of the complaints about Firefox being a memory hog are due to features which simply need a lot of memory, not due to memory leaks (bugs). While it's certainly a good idea to check for, find and close memory leaks, the significance of this effort will not reduce the normal memory usage drastically. Firefox simply does things which require a lot of memory.

    1. Re:Here we go... by Anonymous Coward · · Score: 0

      My work stuff is web based. I start Firefox 1.5, and it starts out with 40-60MB memory used. No big deal.

      By 4-6 hours in, it's at 90MB. After 3-4 days, it gets up to 600-700MB, and I have to close it.

      I have adblock (not plus), and the "brushed" theme, and that's it for addons, and I keep three frames open (CNN, /., the server I work on), and occasionally open/close a couple of more.

      I think there is probably a memory leak in there with that setup, and the expanding memory useage.

      Admittedly, its not the latest firefox, but 2.0 doesn't work with the HTML/Javascript that the server produces.

    2. Re:Here we go... by savuporo · · Score: 4, Insightful

      There are very few "things that require a lot of memory", really. Most of the "things" you do in programming are tradeoffs, often between complexity of implementation, speed and memory requirements. There are usually off the shelf algorithms for each approach. Simplest solutions are often the most inefficient ones.
      There is no reason why a minimal web browser could not be implemented, utilizing something like ~100kb of memory, in fact, i have seen the code to one. However, it wont be a) fast b) portable c) full featured d) very easy to understand

      --
      http://validator.w3.org/check?uri=http%3A%2F%2Fwww.slashdot.org Errors found while checking this document as HTML5!
    3. Re:Here we go... by HarvardAce · · Score: 1

      However, it wont be a) fast b) portable c) full featured d) very easy to understand e) good
      --
      Note to self: Stop putting jokes in my insightful comments so I can get something other than +1 Funny!
    4. Re:Here we go... by _14k4 · · Score: 1

      I agree. In reality, who needs a "full featured" browser, and when/where do they need it. At home, if I'm surfing around the various "portal" sites I use to collect my information (google.com/ig for instance), I could deal with a minimal browser. In fact, I may go look around for something pretty lean when I get home tonight.

      However, here at work, I am frequently sent off to various vendor sites and need a "full" browser that is able to process flash, java script, etc...

    5. Re:Here we go... by moderatorrater · · Score: 1

      That's a bullshit excuse they've thrown around for a while, and it's simply not true. You can turn the memory usage on those features down and firefox still slowly creeps up to using as much memory as it can, and this is without any addons whatsoever. So, either firefox ignores configuration settings or it's a memory leak.

    6. Re:Here we go... by kebes · · Score: 1
      Good points.

      Most of the "things" you do in programming are tradeoffs, often between complexity of implementation, speed and memory requirements.
      As an aside, it's worth noting that the traditional assumption of a tradeoff between speed and memory usage has been challenged in modern computing. In an interview with Jim Gettys, regarding the software challenges of coding for the OLPC, he says:

      Application slimming: There seems to be a common fallacy among programmers that using memory is good: on current hardware it is often much faster to recompute values than to have to reference memory to get a precomputed value. A full cache miss can be hundreds of cycles, and hundreds of times the power consumption of an instruction that hits in the first level cache. Making things smaller almost always makes them faster (and lower power). Similarly, it can be much faster to redraw an area of the screen than to copy a saved image from RAM to a screen buffer. Many programmer's presumptions are now completely incorrect and we need to reeducate ourselves.
      No doubt this isn't universally true: sometimes you will speed up a program considerably by caching difficult-to-compute values, lookup tables, etc. But he is correct in pointing out that many programmers will assume that pre-calculating and storing values is always faster than re-computing them as needed. On modern hardware, this isn't necessarily the case.

      The take-home message is fairly obvious, though sometimes forgotten: reducing memory usage will often yield speed boosts also.
    7. Re:Here we go... by Anonymous Coward · · Score: 0

      Excuse me?

      PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
      28399 jon 15 0 725m 233m 22m S 4 54.0 4:13.90 firefox

      I sure would like to know what "features" are causing this! At least then I can disable them. And no, it does not start like this (fortunately!). Instead it grows and grows and grows to the point where the amount of swapping forces me to restart the bloody thing. Usually after about 4 or 5 days of fairly low intensity browsing (i.e. with most ads blocked and all that).

    8. Re:Here we go... by RonnyJ · · Score: 1

      Opera has significantly more features than Firefox does without some extensions installed, yet Opera definitely isn't a memory hog.

    9. Re:Here we go... by mpeg4codec · · Score: 1

      If you're on a unix system, there are two very nice browsers that I know of:

      Dillo runs on X and uses gtk 1.2 as a toolkit [oldschool]. It doesn't have a lot of features [hell, it doesn't even do CSS], but it's the leanest, fastest graphical browser I've ever used that integrates at all with other X applications.

      Links2 runs in the terminal or [with the -g options] under X. The X version is ugly and doesn't integrate with other X apps, but it works incredibly well and even has support for some more advanced features like Javascript, which of course can be disabled if you like. I frequently run links2 on my laptop with limited memory and, while it may not be as pretty as Firefox, it definitely gets the job done more than 95% of the time.

    10. Re:Here we go... by Anonymous Coward · · Score: 0

      Actually the take-home message is that performance is as always, heavily architecture and generation specific. The tricks you learnt for a 386 are completely wrong for a 786.
      Not great for programmer productivity or indeed programmer work satisfaction when you have to relearn all the fundamentals of programming "to the metal" every 5 years.

    11. Re:Here we go... by vidarh · · Score: 1
      Bah humbug. My problem with Firefox, and the problem of most of the other people complaining, is not memory usage. I have 3GB RAM in my laptop. Apart from Firefox I rarely use even 1 GB. I added the 3'rd GB to reduce my Firefox restarts from many a day to 1-2.

      That memory usage is mostly leaks. Whenever I get Firefox to 1.5-2GB, and close down all tabs, so my only page open is about:blank, and I clear out my cache, and tune the Firefox settings to minimize caching etc., most of that memory never gets freed up.

      Now, it's certainly true that there's a lot that could be improved to reduce memory usage further, but I'd be perfectly happy just to get rid of the leaks. It's not like I regularly "need" to have 80+ tabs open, and even if I do, my machine is perfectly usable with 80+ tabs open initially after a restart if/when that is what I want to do, and I'll still have plenty of memory free.

    12. Re:Here we go... by Bandman · · Score: 1

      This is very true.

      However there are some things in Opera that I can't or don't know how to change that drive me nuts, and I stop using it after about a week.

      Like,

      I am a serial tab opener. Middle click is like crack for me. When I go to a tab that I've opened, and read it, when I close the tab, I want to go to the next tab, not the previous tab. The next tab to the right, the next one I opened. Argh!

      Also, on Linux (ubuntu) I have weird issues with flash not playing correctly, and it works great in Firefox (for a few hours, till I have to kill -9 firefox-bin, that is).

    13. Re:Here we go... by m50d · · Score: 1
      There is no reason why a minimal web browser could not be implemented, utilizing something like ~100kb of memory, in fact, i have seen the code to one. However, it wont be a) fast b) portable c) full featured d) very easy to understand

      Perhaps, but Opera does a, b and c (no idea about d, but last time I checked firefox wasn't much good on that front anyway) in a lot less memory than firefox.

      --
      I am trolling
    14. Re:Here we go... by Tim+C · · Score: 1

      That really depends on exactly what you mean by "surfing around", but you have to have JavaScript enabled to use google.com/ig.

      Of course, once you've set it up in a more fully-featured browser, that minimal browser you're after might be enough to just read the page.

    15. Re:Here we go... by Anonymous Coward · · Score: 0

      There is no fscking way on this earth you're going to write a full-featured "Web 2.0" compatible browser in 100kB. No way in hell.

      The Javascript engine alone would be lucky to fit in 100kB. Consider Lua which is close to Javascript in syntax complexity and about as small as you can get for scripting languages is still on the order of 50-80kB on most systems.

    16. Re:Here we go... by savuporo · · Score: 1

      first, there's no such standard like "Web 2.0".
      second, code space does not equal freestore(heap) or stack space. often, one is a tradeoff for other.
      third, see my post above. i said that you have to sacrifice features.

      i could also tell you about what i HAVE implemented in under 100kb of Thumb codespace, but its not possible, no way in hell, so why bother :)

      --
      http://validator.w3.org/check?uri=http%3A%2F%2Fwww.slashdot.org Errors found while checking this document as HTML5!
    17. Re:Here we go... by dreddnott · · Score: 1

      233 millibytes isn't really that much of your computer's resources, when you get right down to it. Add in the virtual memory and it's only 0.97 bytes.

      --
      I may make you feel, but I can't make you think.
  5. Yay! by benmatth · · Score: 1

    This is what has been keeping me off Firefox on my memory-lacking iBook.

    1. Re:Yay! by Generic+Guy · · Score: 1

      This is what has been keeping me off Firefox on my memory-lacking iBook.

      Maybe when they finally fix the memory bug, perhaps they'll begin fixing the Copy-Paste clipboard bug. Or should I say, the not Copy-Paste bug. It is especially bad on my intel iMac. (Opening New windows instead of tabs exposes the problem particularly well.)

      I like Firefox, but these ongoing years-long problems make you difficult to recommend!

      --
      { - Generic Guy - }
    2. Re:Yay! by Mr.+Underbridge · · Score: 1

      Same here. I have a PB with 512 MB RAM and I finally gave up on Firefox. Tried Camino - loads pages faster, doesn't appear to be as bad a memory pig as firefox. Not sure why it doesn't share the same flaws since they share a great deal of code, but there you go. Seems to panic less than Safari too.

      With either FF or Safari, I'm staring at the SBOD much more than I'd like, but it doesn't seem to happen with Camino. I'm pretty happy with it.

      I'm sad for Firefox. Started out as this nice fast, beautiful little web browser that shed all the Mozilla bloat and modularized all the little features. Now look what happened to it, a big disgusting memory-gorging pig.

  6. That's good news by Anonymous Coward · · Score: 0

    I'm tired of Firefox being like a cartoon snowball rolling downhill: once the little bugger gets going, it just gets bigger and bigger until it becomes an unstoppable memory eating monster.

  7. but but by svendsen · · Score: 4, Interesting

    everytime I mentioned the memory issue I was always told it was a plugin or there was something wrong with my system or something about my mother and a donkey. Certainly firefox fan boys wouldn't have just attacked me because I questioned something...would they? :-D

    1. Re:but but by Anonymous Coward · · Score: 0

      Of course there are memory leaks. It's a big program, there always have been and always will be memory leaks. Of course, working on closing memory leaks isn't something new. And yea, plugins are and have been the biggest cause of serious memory leaks. That and leaving firefox open for weeks on end while opening and closing hundreds of tabs, on some systems, it seems.

      I, and most people who use firefox, never have issues with memory leaks.

    2. Re:but but by onetwentyone · · Score: 2, Funny

      Could be worse, you could have questioned Firefox's memory handling on a Beowulf cluster of Linux boxes conveniently cooled with a hobby-built liquid nitrogen heat exchange.

    3. Re:but but by Martin+Blank · · Score: 1

      Exactly my thoughts. I'm constantly told things like, "There's no memory leak! It's a feature to help you undo closed tabs!" When my memory usage routinely passes 250MB with an average of only 4-6 tabs open through a session (with many tabs being closed along the way), it's not a feature. It shouldn't be remembering 12 tabs past.

      Or they blame my "extensive" list of plugins, even when on one system I have only about a dozen total, most of them minor functionality enhancements like Copy Plain Text and PDF Download.

      Memory utilization hasn't gotten any worse from the later stages of 1.x, but it certainly hasn't gotten much better. It's really hard to convince people of the superiority of Firefox when they see those kind of performance numbers.

      --
      You can never go home again... but I guess you can shop there.
    4. Re:but but by MBCook · · Score: 4, Interesting

      I've heard that too. I use FF on my desktop at work with one or two plugins (FlashBlock and FireBug, mostly). It does leak memory after enough time. Closing the browser always fixes it, so it's not much of a problem.

      That said, if a plugin leaks memory, there are a few options. First, the system should know. Even if the plugin in used constantly, I should be able to open the extensions options panel and see how much memory each one is using, so I can identify the culprit. There should be a warning system ("Plug-in 'MemHog2' is using 500MB of ram, close/ignore/disable?").

      Also, when a plugin isn't in use, then it shouldn't cause a problem. Let's say that the problem is Flashblock. If it isn't actively rendering (say I only have one window/tab open and it's pure text, no flash/etc) then it really shouldn't be using any memory. If I have FireBug inactive it should use next to no memory (when I have it actively checked CSS/JS/etc I expect it to use memory).

      I'm glad they are working on this. I've heard this complaint for a while. But even if the problem is the plugins, it needs fixing or roping in.

      How about being able to set memory limits for plug-ins, Mac OS 1-9.x style? Maybe total, maybe per active page, maybe both. Just a random idea.

      --
      Comment forecast: Bits of genius surrounded by a sea of mediocrity.
    5. Re:but but by Anonymous Coward · · Score: 0

      It's OpenSource®

      Kwitcherbitchen, fix the leaks, and send the fixes back.

    6. Re:but but by Anonymous Coward · · Score: 0

      If you read the actual details, you'll see that they worked on new techniques moreso than real "memory leaks" being plugged. One of the things is that they'll garbage collect objects if they're no longer necessary in the time domain. Additionally, they've also worked significantly in plugging holes in the most popular extensions.

    7. Re:but but by geekgirlandrea · · Score: 1

      It's a big program, there always have been and always will be memory leaks.

      This attitude is the whole problem in a nutshell. I can leave the kernel running for months or years on end without anything going wrong because of memory leaks, and I should be able to the same thing with my web browser.

    8. Re:but but by caluml · · Score: 1
      Just put this in root's crontab :

      * * * * * killall -9 firefox firefox-bin 2>&1 >/dev/null
      Guarantee you, you'll never notice memory leaks in Firefox again.
    9. Re:but but by SatanicPuppy · · Score: 1

      Meh. They say plugins, but I haven't noticed notably more problems on my work machine (a zillion plugins), my home machine (two or three plugins), and my wife's machine (honey, what's a plugin?). That's Windows XP, Linux Fedora 5, and Mac OS X Panther, for those who care.

      They all have memory creep. They all slow down. And they all need to be killed on occasion when they lock up. I'd say it's a technical achievement to have the same bug set on all platforms.

      I really like Firefox. I'd really like to keep using Firefox. But I'm getting to the end of my patience. Enough with the goddamn widgets. I want it clean and fast; I can add plugins and bloat it up myself.

      --
      ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
    10. Re:but but by Actually,+I+do+RTFA · · Score: 1

      everytime I mentioned the memory issue I was always told it was a plugin...

      I got told the same thing. "But I didn't install any extensions," I said. Well, it must be my system. "But FireFox was the first program I installed on a new machine," I said. At that point I found out I was a liar.

      --
      Your ad here. Ask me how!
    11. Re:but but by BenoitRen · · Score: 1

      I wish people would stop confusing plug-ins and extensions.

      Anyway, a major offender that contributes a lot to Firefox' memory usage is the Java plug-in.

    12. Re:but but by Inda · · Score: 1

      >> There should be a warning system ("Plug-in 'MemHog2' is using 500MB of ram, close/ignore/disable?").

      Excellent idea! Someone should write a plug-in (extension) to do this!

      --
      This post contains benzene, nitrosamines, formaldehyde and hydrogen cyanide.
  8. Firefox != Internet by realdodgeman · · Score: 5, Insightful

    Here's hoping. Frequent restarts of things on my computer make me furious. I can't imagine why anyone would tolerate such things.


    Nobody forces you to use Firefox. You can use Opera, Konqueror, links or IE, or any other browser out there...
    1. Re:Firefox != Internet by Anonymous Coward · · Score: 0

      restarts make Hulk mad!!! grrrrrrrrrrrrr

      STFU and deal, nancy

    2. Re:Firefox != Internet by the_humeister · · Score: 1

      What??? You suggested IE over Firefox? I'm surprised you weren't modded down to "-20 Microsoft shill"...

    3. Re:Firefox != Internet by JimNTonik · · Score: 1

      Unfortunately many people do That said, it's getting better each revision. I just wanted to point out that in some situations it's the only "officially supported" choice.

    4. Re:Firefox != Internet by Anonymous Coward · · Score: 0

      >>Nobody forces you to use Firefox.

      SLASHDOT and all the fanboys force me to use Firefox. I am not even a Nerd, much less a Geek if I use IE. Just trying to protect my manhood here.

      Well, other than the memory issue, I do like it.

      But I do have an old copy of Mosaic laying around..........

      crabbyoldguy

    5. Re:Firefox != Internet by suv4x4 · · Score: 3, Interesting

      Nobody forces you to use Firefox. You can use Opera, Konqueror, links or IE, or any other browser out there...

      Firefox was supposed to be able to withstand popularity, unlike IE. Look at it now: people say it's slow, RAM hog, and hackers have started attacking it successfully just as much as IE.

      At least we see it for what it is: the stick in Microsoft's eye that made them resume IE development.

    6. Re:Firefox != Internet by realdodgeman · · Score: 1

      Look at the order... I suggested Opera, Konqueror and even links over IE. But I use Firefox myself, and I think it is the best browser despite of it's memory leaks. I just wanted to point out that Firefox is not alone. If you don't like it, find something else, or stop complaining.

    7. Re:Firefox != Internet by slack_prad · · Score: 1

      What's with the negativity? Why not help make it a better browser by pointing out it's problems?

      --
      Sent from my desktop computer
    8. Re:Firefox != Internet by Anonymous Coward · · Score: 0

      You know, ive *never* had to restart my machine because of firefox. Ive seen slowdowns & the browser itself has crashed out a time or two, & ocastionally a script somewhere will lock it up, but ive *never once* had to reboot the whole machine.

      Maybe cmdrlimo needs to switch to a more stable OS... XP works good for me :)

    9. Re:Firefox != Internet by Matt+Perry · · Score: 1

      Here's hoping. Frequent restarts of things on my computer make me furious. I can't imagine why anyone would tolerate such things.
      Nobody forces you to use Firefox. You can use Opera, Konqueror, links or IE, or any other browser out there...
      While that is true, those other browsers either don't have the extensibility of Firefox or don't have the same variety of add-ons. For some people Firefox has become the new operating system (this is how I look at Firefox) and what OS it runs on is largely now irrelevant. Switching to another browser isn't feasible as the add-ons that they need might not be there. I realized this when, as a long-time desktop Windows user, I have recently started making the switch to Ubuntu Linux. I realized that I spent at least 99% of my time using my web browser so it doesn't matter which OS I used. Firefox has become my OS in a way.

      For people who think like me the following is true:
      • Firefox = operating system
      • Add-ons = applications
      Given that, would you be happy if you had to restart your OS once a day because of poor memory management?
      --
      Slashdot: Failed Car Analogies. Amateur Lawyering. Anecdote Battles.
    10. Re:Firefox != Internet by shutdown+-p+now · · Score: 1

      My hope is for WebKit now. Konqueror was always pretty fast, and now that we've got WebKit integrated into Qt 4.4, it's going to be available on all major platforms for any browser writers out there to use easily (and I've heard the Gtk guys have been working on that as well, so that next version of Epiphany can use WebKit as a backend). Qt GUI would surely beat the slow dog that is XUL on any platform.

    11. Re:Firefox != Internet by Arctech · · Score: 1

      "...just as much as IE."?
      Look up the list of unsafe web addresses that Spyware Blaster puts in IE's restricted sites list and consider that statement again.

  9. too litlle too late by wwmedia · · Score: 2, Insightful

    too little too late some people i know have switched to alternatives like Opera or back to IE7 (both use substantially less resources on windows) due to all that ram hogging

    1. Re:too litlle too late by IndustrialComplex · · Score: 3, Insightful

      You know they messed up bigtime when people would opt to go back to IE.

      --
      Out of modpoints but really liked a post? 1BDkF6TtmmeZ3yqXbz9yhdYVqRYnwFoXDj
    2. Re:too litlle too late by wwmedia · · Score: 1

      well when a laptop has fuck all ram, and Firefox use 120MB ram to open 1 page and IE7 uses 4MB ram to render same page, something is messed up

    3. Re:too litlle too late by MyLongNickName · · Score: 1

      You laugh, but for flash based gaming I prefer internet explorer. Now I know that isn't truly a FireFox issue, but it is the only reason I ever launch ie.

      --
      See my journal for slashdot ID's by year. Mine created in 2005. http://slashdot.org/journal/289875/slashdot-ids-by-year
    4. Re:too litlle too late by IndustrialComplex · · Score: 1

      If only I was laughing. I've seen firefox go over 120Mb of ram on regular occasions. I HAVE to close it if I plan on doing anything else on my laptop. Often I'm running another program that is sucking down 250-300 mb of ram so tacking on an additional 120 really isn't acceptable.

      I've thought about stripping out the extentions to see if any of that helps, but it doesn't appear from this thread that they are the real issues. And if I were to strip out all the extras that I like, and end up with a browser that is slower and uses more ram than IE, why not use IE?

      I'll probably check out Opera this weekend. Does anyone have any suggestions other than IE?

      --
      Out of modpoints but really liked a post? 1BDkF6TtmmeZ3yqXbz9yhdYVqRYnwFoXDj
    5. Re:too litlle too late by realdodgeman · · Score: 1

      too little too late some people i know have switched to alternatives like Opera or back to IE7 (both use substantially less resources on windows) due to all that ram hogging
      Firefox is still growing. Therefore it is not too little to late, but exactly what it needs, just on time.
    6. Re:too litlle too late by TheRaven64 · · Score: 1

      Firefox is still growing. Yes, but according to TFA they're trying to fix that.
      --
      I am TheRaven on Soylent News
    7. Re:too litlle too late by Anonymous Coward · · Score: 0

      Opera 9.23 sucks a bit, memory-wise. Try the 9.5 beta from this page, but beware, it's still got some issues. I've currently got 18 pages open, of widely varying complexity (anywhere from a 1996 or so page to slashdot's new discussion system), and it's using 88 megs at the moment. It's been running for approximately 4:45 hours, and in this time it's used 6:50 minutes of CPU time. On Windows things might be different.
      For a browser to use 120 megs isn't unusual at all. Once I've had about 70 tabs open in Opera 9.something, and it used something between 150 and 200 megs, I think. But this isn't really a problem, because I've got 384 megs of RAM. And if I've got 70 pages open, chances are that the browser is my primary app at that moment.
      BTW, what other app do you use that sucks 250-300 megs? I think you should lay it off or look into alternatives to that one, unless it really does work with extremely large datasets. (Just guessing here, is it Adobe Photoshop?) I think that browsers, as they are one of the most important tools in my job, can justify using quite some memory. I'm sure that they're important to you too, so you probably shouldn't say something like "tacking on an additional 120."

    8. Re:too litlle too late by TheLink · · Score: 1

      At work I've a 2GB machine running linux, and I run Windows XP in vmware on it.

      After a few days it's not unusual for firefox on Linux to use more memory than my entire Windows XP virtual machine (which uses 300-400MB, runs IE, IM clients, MS viewers, etc).

      I do open quite a lot of tabs and windows, but I do that on Windows too.

      On my real (nonvirtual) windows machines my windows taskbar is double height - and I've had it "scroll" before. There's a limit of how many IE windows you can have open and I've hit it before, but my machine just stopped allowing me to open more windows rather than die or swap to death.

      Maybe this time I won't get modded flamebait/troll for just stating the facts.

      --
    9. Re:too litlle too late by Anonymous Coward · · Score: 0

      Konqueror if you're on a nix system, Safari if you're on a windows/mac system.

      If you happen to be on a Gnome desktop you're fsck'ed, at least until they move their browser from geko(firefox engine) to webkit(konqueror/safari engine) which they are doing right now but haven't completed AFAIK

    10. Re:too litlle too late by griffjon · · Score: 2, Insightful

      I use firefox on my slow, memory-starved laptop. Opera is faster, but I just can't live without adblock in the modern web age of big flashy annoying ads.

      That being said, I'd love a lighter main firefox branch that would run happily with less ram.

      --
      Returned Peace Corps IT Volunteer
    11. Re:too litlle too late by Helmholtz · · Score: 1

      I use the following:

      http://www.fanboy.co.nz/adblock/opera/urlfilter.ini

      with Opera. In many respects, I find it easier to deal with than adblock. I have a daily rsync cron job that updates the file, and that's all there is to it. As a firefox user for many years, the main reason I went to firefox was to escape the massive bloat that had become the mozilla (now seamonkey) application collection. Unfortunately, while firefox started out lean, it seems to have gradually grown larger and larger and larger.

      So far, I've been very happy with Opera, though if firefox (or some other browser) manages to become the next "lean and mean" web browser, I'll probably switch again.

      --
      RFC2119
    12. Re:too litlle too late by vidarh · · Score: 1

      You're lucky. Firefox on my laptop is currently hovering around 600MB with 8 tabs open, and this is after restarting it only a few hours ago.

    13. Re:too litlle too late by zbuffered · · Score: 1

      Ad Muncher isn't free, but is is written in assembler, and it's super fast. It doesn't care what browser you're using. It's got a million features. Good luck!

      --
      Synergy is your friend
  10. Try Opera by Anonymous Coward · · Score: 0, Informative

    It runs well on your cellphone, Nintendo Wii/DS and pretty much anything else with a screen & network connection, So I think it's safe to assume it will work on your desktop.

    1. Re:Try Opera by Wolvie+MkM · · Score: 1

      I found I had less rendering problems with Opera than with Firefox. I would have stuck with it at the time but Opera didn't support the built-in ghetto gTalk on the GMail website.

      Now this was probably a year a go I tried it... So there is a fairly good chance I might be talking out of my ass now.

      --
      I Like Pie...
  11. Symmetry by Harmonious+Botch · · Score: 1, Interesting

    Are there really any memory problems that cannot be cured by strict adherance to the rule of "allocate memory at the beginging of a routine, deallocate same amount at the end"?

    1. Re:Symmetry by Zelos · · Score: 4, Funny

      No, and there are no bugs that can't be prevented by writing perfect, correct code.

      I think the problem's in the details...

    2. Re:Symmetry by Anonymous Coward · · Score: 3, Informative

      LOL, maybe if you're working in a purely functional programming language :P if that were really the case, you could allocate everything on the stack. In practice, it's often necessary to keep stuff around in dynamically allocated memory between function calls, which is why we have the heap.

    3. Re:Symmetry by ucblockhead · · Score: 4, Funny

      Well, yeah. And you could prevent any memory leaks at all by requiring that malloc never be used and that everything be placed in static memory.

      Kinda hard to code like that, though.

      --
      The cake is a pie
    4. Re:Symmetry by Anonymous Coward · · Score: 0

      As I understand, much of the memory issues aren't really leaks (though I'm sure there are some) and more to do with overly agressive page caching.

      That said, I've noticed the version of Firefox that comes with Fedora Core 7 (2.?) doesn't seem to have this problem any more. My work machine still runs Firefox 1.5, and I have to restart the browser every couple of days. But my home machine has been up for weeks with way to many tabs open and no problems. Well, no problems after I ditched the crappy Gnu flash plugin which quickly ate all of my memory and crashed KDE.

      One thing I would like to figure out - how to get rid of the missing plugin reminder bar? I ditched the Gnu flah plugin. I really don't care to have a flash plugin at all. But firefox pops up this bar at the top of every page with flash telling me I don't have the right plugins installed. Yes, I know - that's by design! How do I get it to shut up about it??

    5. Re:Symmetry by frantzdb · · Score: 1

      First, if that is your memory model, you should be using RAII tools like auto_ptr . Second, unfortunately, there are times when memory usage is more complicated. For example, when there are multiple views of the same object and that object should be deleted only when the views all disappear. I haven't looked into Firefox, but in general, I almost never trust myself with delete; it's too easy to leak memory. Even without garbage collection, you can go a long way with various smart pointers.

    6. Re:Symmetry by iabervon · · Score: 2, Informative

      The easiest way is to get the flashblock extension and some flash plugin, and never click on a flash thing. There's also some way to make a plugin registered for flash that does nothing.

    7. Re:Symmetry by TemporalBeing · · Score: 2, Informative

      Are there really any memory problems that cannot be cured by strict adherance to the rule of "allocate memory at the beginging of a routine, deallocate same amount at the end"?
      This would be better states as: "allocate memory when needed and dellocate when no longer required" - memory allocations/dellocations do not always occur in the same routine, and this only gets worse in OO programming. However, garbage-collection does not resolve the issue either. The real answer is smart design and smart programming - and by smart programming I am not talking about garbage-collectors, etc. done for the programmer, I am talking about programmers programming smartly so that their programs manage their resources properly and efficiently.

      Which brings my second point - even with your original version, this cannot always be done in some languages as some languages remove the ability to free resources. For example, so far as I am aware - and so far as I can tell - Java cannot free memory resources outside of the garbage collector. So much for a programmer being able to manage their resources properly - this is probably also one of the big reasons Java sucks at performance.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    8. Re:Symmetry by ObsessiveMathsFreak · · Score: 1

      Recursive function calls, probably.

      --
      May the Maths Be with you!
    9. Re:Symmetry by hchaos · · Score: 1

      Are there really any memory problems that cannot be cured by strict adherance to the rule of "allocate memory at the beginging of a routine, deallocate same amount at the end"?
      If only one thread is running on your computer, then no. As soon as you start dealing with multiple threads, you cannot strictly adhere to that. Of course, there's also the issue that certain non-memory problems cannot be solved if you are strictly adhering to that rule. Without going into too much detail, maintaining state, almost by definition, requires allocating memory that does not get deallocated for the lifetime of the application. And I've never seen a non-trivial application that did not require maintaining state.
    10. Re:Symmetry by TheRaven64 · · Score: 1

      That's fine if your language doesn't support aliasing, but if it does then it's quite possible to create a data structure and have a reference / pointer to it held by something outside the routine by the end. If you deallocate the memory, then the other pointer / reference will become invalid. At the very least, you need reference counting.

      --
      I am TheRaven on Soylent News
    11. Re:Symmetry by KillerCow · · Score: 1

      Are there really any memory problems that cannot be cured by strict adherance to the rule of "allocate memory at the beginging of a routine, deallocate same amount at the end"?


      Yes, when "the end" is not clear due to a transfer of ownership.
    12. Re:Symmetry by cnettel · · Score: 1

      So, how do you handle the browser history? Moving to a new page the first time means that the previous page should still be in the history. When you get to the 1000th page, maybe you want to clean up, but strict adherence to your rule doesn't allow that.

    13. Re:Symmetry by ultranova · · Score: 1

      Which brings my second point - even with your original version, this cannot always be done in some languages as some languages remove the ability to free resources. For example, so far as I am aware - and so far as I can tell - Java cannot free memory resources outside of the garbage collector. So much for a programmer being able to manage their resources properly - this is probably also one of the big reasons Java sucks at performance.

      Are you trying to argue that it's a bad thing that you can't leave dangling pointers in Java ?

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    14. Re:Symmetry by stinerman · · Score: 4, Funny

      There's also some way to make a plugin registered for flash that does nothing.
      You don't have to be so mean. Yeah, so Gnash is still in alpha but it's coming along...
       
      :-)
    15. Re:Symmetry by gatzke · · Score: 1



      Just make a big iwork and dwork to pass around in your FORTRAN calls then go to town...

      Not hard to code at all!

    16. Re:Symmetry by jimicus · · Score: 2, Insightful

      You jest (I assume), but it is actually quite possible to code like that. In fact, in a previous job of mine part of the internal coding guidelines said "Don't use malloc".

      There is a major difference though - the problem they were trying to solve didn't involve a user interface and didn't deal with data of undefined size - it was basically a large database app.

      Of course, under the hood the compiler has to allocate memory at some point for more or less everything - but it's something the compiler can worry about, not the developer.

    17. Re:Symmetry by multipartmixed · · Score: 1

      Just allocate a giant static array of bytes. Then write a routine which allows to indicate which of those bytes are currently allocated, and which are free for use by bits of your code.

      Just don't call the giant array m. Call it, say, n. Then your code could call nalloc() to get memory.

      An added bonus is that that the FIRST time you used the memory, it would be initialized to zeroes. You could write some really awesome code relying on that side effect!

      --

      Do daemons dream of electric sleep()?
    18. Re:Symmetry by multipartmixed · · Score: 1

      > If only one thread is running on your computer, then no.

      Counter example: Write a routine to modify **environ.

      --

      Do daemons dream of electric sleep()?
    19. Re:Symmetry by TemporalBeing · · Score: 1

      Are you trying to argue that it's a bad thing that you can't leave dangling pointers in Java ?
      No, I'm saying that it should be possible for the programmer to, at the very least, tell the GC that memory chunk X is no longer needed, so the GC knows 100% for sure that it can de-allocate that memory. Sure, it'd make the GC a bit more complex, but it would also help out with managing resources - for efficient programs, a programmer must be able to say "I don't need this memory any more, please take it back, and let me use it elsewhere, for other things, in the program". Java doesn't provide that.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    20. Re:Symmetry by Anonymous Coward · · Score: 0

      I hear this is why all programs linked with GNU libc leak so much: their malloc() doesn't obey this at all.

    21. Re:Symmetry by ultranova · · Score: 1

      No, I'm saying that it should be possible for the programmer to, at the very least, tell the GC that memory chunk X is no longer needed, so the GC knows 100% for sure that it can de-allocate that memory.

      Except that it can't. The programmer could be wrong or purposefully lying, and in fact still have a reference to this object. This, then, breaks type safety and might allow arbitrary code execution flaws.

      Besides, a modern relocating garbage collector doesn't free a memory chunk, but simply goes through and moves all live objects into the start of the heap, leaving the rest a single free chunk. In this scheme telling the system that a given chunk is free is not useful in any way.

      Sure, it'd make the GC a bit more complex, but it would also help out with managing resources - for efficient programs, a programmer must be able to say "I don't need this memory any more, please take it back, and let me use it elsewhere, for other things, in the program". Java doesn't provide that.

      Yes it does. Not having any references to the object in any live object means that the memory it used may be reused after the next garbage collection cycle, which occurs automatically when free memory in the heap runs out.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    22. Re:Symmetry by TemporalBeing · · Score: 1

      Except that it can't. The programmer could be wrong or purposefully lying, and in fact still have a reference to this object. This, then, breaks type safety and might allow arbitrary code execution flaws...Yes it does. Not having any references to the object in any live object means that the memory it used may be reused after the next garbage collection cycle, which occurs automatically when free memory in the heap runs out. Yes it can. Simply providing the programmer a way to remove that reference counter would do it. As it stands, languages like Java provide no functionality to do so. Whatever the method is, it must match the algorithm used by the GC to do the garbage collecting.

      Additionally, the programmer can be wrong - that's the programmer's prerogative, and the system should detect and handle that appropriately - but the tool to do so is still necessary in order to deliver true performance applications. In fact, there is a whole methodology of programming that can handle that mistake - Defensive Programming.

      And, to know, one of my issues with the C library is the lack of the ability to hand it a pointer and say "is this valid?" and " is this at least this size?" as that would go a long ways in Defensive Programming. The first question answers whether the pointer is valid - i.e. directly returned from a call to malloc() or from a buffer within one directly returned from a call to malloc() - and the second question answers the size of buffer and if there is enough space to so something. This could be easily tracked, though it would add a little overhead, and would be of great use in Defensive Programming technique.

      There is always going to be some way that the programmer will be able to be wrong. However, that can only be countered by the programmer having the right tools to detect when that occurs and handle it appropriately. GC is not necessarily one of those tools.

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    23. Re:Symmetry by david_thornley · · Score: 1

      No.

      For example, you could allocate all available memory while starting up the program, and release it when the program quits.

      If you want to do anything useful and halfway efficient, you're going to be allocating objects (or whatever) that stay beyond the end of the calling routine.

      However, that's a functionality problem, not a memory problem.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    24. Re:Symmetry by vidarh · · Score: 1
      It's perfectly possible to allow early deallocation in many or most cases (depending on performance/complexity tradeoffs) without causing any problem with dangling pointers.

      Either you can let the compiler do static analysis to determine points where it is legal to deallocate (in that paper they also insert the free operation automatically as well, and see a significant reduction in overall memory usage), or you can support "weak pointers" (pointers that, whether via an extra indirection or a flag etc. can be checked for liveness of the object, or you can use ref-counting and only allow frees when there's only one reference, or you can let the compiler trace any variables free'd backwards and throw an error if at any point there's a chance of leaving a dangling pointer, or you can do a mark phase on the free call (potentially very expensive, though).

      There are good reasons to do at least the static analysis, as the linked to paper shows - it's extra work compile time to significantly improve resource usage at runtime - a good trade-off.

      But several of these options (ref-counted smart pointers, weak pointers etc.) are common idioms in C++ when dealing with allocation patterns where RAII and simple scoped smart pointers isn't sufficient.

    25. Re:Symmetry by ucblockhead · · Score: 1

      It was a joke, but it comes from experience. I worked for five years on an embedded application written entirely in C for which the C libraries did not implement malloc. All code had to fit in 128k (some of it bank-switched in and out of RAM) and the stack was obviously fixed size. Everything had to be either a local variable or a static. Real fun.

      --
      The cake is a pie
    26. Re:Symmetry by ultranova · · Score: 1

      Yes it can. Simply providing the programmer a way to remove that reference counter would do it.

      There is - just set the reference to null. Or do you perhaps mean a way to force all references to this object to become null ? That would have rather nasty side effectsfor any other code using the object.

      Additionally, the programmer can be wrong - that's the programmer's prerogative, and the system should detect and handle that appropriately - but the tool to do so is still necessary in order to deliver true performance applications.

      Yes, because garbage collection is the performance killer in Java.

      The first question answers whether the pointer is valid - i.e. directly returned from a call to malloc() or from a buffer within one directly returned from a call to malloc() - and the second question answers the size of buffer and if there is enough space to so something. This could be easily tracked, though it would add a little overhead, and would be of great use in Defensive Programming technique.

      It wouldn't be just a little overhead: either you travel the list of malloc-returned pointers, or you keep them in a hashtable of some sort. Since I predict few programmers would bother using this - since they don't bother checking for NULL or buffer length now - associating this cost with every C program (as having the functionality in the C library would require one to do) is not really justified.

      Even worse is that it doesn't solve the problem. What if, just after you checked the pointer for validity, another thread frees it ? Your program ends up misbehaving. Or what if you check the pointer for validity, and some function call a bit later ends up freeing it ? Don't forget that C++ has the lovely feature of opeation overloading, so the call could happen as a result of any operation and be quite effectively hidden. Are you going to recheck the pointer after every operation ?

      Garbage collection solves this problem automatically and with minor or no performance hit.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    27. Re:Symmetry by dave1g · · Score: 1

      In C++ a full proof way to avoid memory leaks is to store all of your objects in an stl container. Allocate on stack for temporaries, and anything that has tot stick around, throw it into a container, like a map where you can get back to it with some key. Of course this has draw backs as well. namely its goign to be a little slower.

  12. here we go again by krod4 · · Score: 0

    line up the fanbois that refuse there can be anything wrong with firefox and memory consumption... for years people have asked what the hell is up with memory usage, and for years the same stubborn people has refused any problems..

  13. It's enough to make anyone consider using IE... by xxxJonBoyxxx · · Score: 0, Redundant

    Frequent restarts of things on my computer make me furious. I can't imagine why anyone would tolerate such things

    I know. It's enough to make anyone consider using IE...
    1. Re:It's enough to make anyone consider using IE... by just_another_sean · · Score: 1

      Whoa, let's not go crazy here!

      Sir... Sir.... SIR! Put down the mouse and back away from the browser!

      --
      Creationist Textbook Stickers Declared Unconstitutional by CowboyNeal
    2. Re:It's enough to make anyone consider using IE... by mother_reincarnated · · Score: 1

      I use a browser launched VPN client. And I in fact always have IE open for that and Firefox open for use as a web browser.... I have to restart Firefox at least twice a day to keep memory utilization reasonable and it's a pain to have to reauth. I really don't care *what* causes such horrible memory leaks (but it must be either Live HTTP Headers or Web Developer in my case) but the thing sucks up 350-500mb after a few hours of use.

  14. Restart your *computer*? by revscat · · Score: 0

    Frequent restarts of things on my computer make me furious

    Shit Taco, what OS are you using? FF leaks on my OS X box too over time, but quitting the app seems to free up the memory.

    Or maybe I'm not paying close enough attention.

    1. Re:Restart your *computer*? by EvanED · · Score: 1

      Who said restarting the computer? What do you call quitting FF then opening it again?

    2. Re:Restart your *computer*? by mrchaotica · · Score: 1

      On my Mac, if I leave it running with Firefox open for a few days I eventually have to restart it -- the whole computer, not just the program -- because it runs completely out of disk space. I've got about 1.7GB free normally, but Firefox (at least, I think it's Firefox; I haven't done formal, rigorous tests but I'm reasonably sure) eventually churns through enough virtual memory (even though I have 2GB of RAM), temporary files, or something that it uses up that entire 1.7GB. Quitting Firefox doesn't delete the temporary files; only restarting the computer does.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    3. Re:Restart your *computer*? by Anonymous Coward · · Score: 0

      What kind of (semi-decent) OS does not free application memory after application is stopped ?
      It should always be enough to kill application, rebooting whole computer is like amputating
      both legs with out a reason.

    4. Re:Restart your *computer*? by Bandman · · Score: 1

      Same here. "Your computer is running low on disk space". Reboot computer, 1.5GB free.

      I actually just reverted to firefox 1.5 on my powerbook (thank you http://mac.oldapps.com/firefox.php), so we'll see how it goes.

    5. Re:Restart your *computer*? by mrchaotica · · Score: 1

      I HATE that damn dialog box!!!!

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    6. Re:Restart your *computer*? by prandal · · Score: 1

      So do I.

      I fail to see how going home and restarting MY computer is going to resolve the issues on the one I'm using.

      The English language has a perfectly good four-letter word which Microsoft should have used instead of "your" in that context.

      THIS

    7. Re:Restart your *computer*? by mrchaotica · · Score: 1

      Uh, that's an Apple dialog box, mot a Microsoft one.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  15. Restarting Isn't much of a problem by Gertlex · · Score: 4, Informative

    Here's hoping. Frequent restarts of things on my computer make me furious. I can't imagine why anyone would tolerate such things.

    I tolerate it with an extension that provides a restart button on the toolbar. There are several such extensions. It's also useful for when one wants to quickly restart after installing/enabling/disabling an add-on/theme.

    And of course, said extensions reload Firefox with the windows/tabs you had open.
  16. Surprise search engine choice! by operagost · · Score: 0, Offtopic
    Well, at least this project discovered a new way to find pr0n:

    Robert Sayre created a script to load random pages and see whether they cause leaks. The random URLs come from the Yahoo directory (biased toward older, top-level pages), del.icio.us (biased toward newer, geeky pages), and AltaVista (biased toward pornography).
    --

    Gamingmuseum.com: Give your 3D accelerator a rest.
  17. You're already tolerating it by using it at all... by mgkimsal2 · · Score: 4, Insightful

    I can't imagine why anyone would tolerate such things.

    Well, my guess is that you *are* tolerating it, as are millions of others, simply because you're using it (either older versions of IE, or current versions of Firefox). Can't comment on IE7 cause I don't use it much, but IE6 rarely crashed for me. IE3-5.5, almost daily crashes.

    5 years ago people people would constantly belittle IE users because it had frequent crashes, and pointed to the 'superior' Mozilla suite. Today, FF has morphed in to something which can't be used, with plugins, for more than a couple days max without needing to be reset. I add the caveat in there about 'with plugins' because I'm not sure I know many people who run a bare-metal Firefox. Most people use one or more extensions. This has been a huge marketing push for FF - "It's lean! Only use what you need! Get rid of 'bloat' - package everything in extensions!"

    Putting things in extensions makes the base 'leaner' but has lead to a situation where there's no centralized testing for, or even acknowledgement of, memory leak bugs (and other bugs, but this is the obvious one). I still read comments from people who claim they never have leaks with FF (we'll see some on this thread no doubt). It's not that I don't believe them, but their usage patterns are likely different from mine. I have about 6 plugins that I love to use, and I like to keep my browser going. The idea that MSIE is more "stable" than FF for daily usage should remind people that resting on your laurels is not an option. What cut the mustard 5 years ago isn't gonna cut it any more.

  18. C++ long-in-the-tooth? by Tablizer · · Score: 0

    Perhaps the culprit is C++. Languages with auto-garbage-collection or are database-engine-based tend to clean up automatically or cache to disk more effectively. C/C++ just seems to have so many low-level crevices to accidently mess up with.

    1. Re:C++ long-in-the-tooth? by deftcoder · · Score: 2, Insightful

      The culprit is poor programming.

      If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!

      --
      Peace sells, but who's buying?
    2. Re:C++ long-in-the-tooth? by ObsessiveMathsFreak · · Score: 4, Funny

      If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!
      Professional computer programming, for example.
      --
      May the Maths Be with you!
    3. Re:C++ long-in-the-tooth? by SilentChris · · Score: 4, Insightful

      If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!


      Or perhaps they're too busy thinking about clearly-defined objects, robust interfaces, clean documentation and the "big picture" then to worry about moving individual bytes around.

      Likewise, I don't trust any artist using Flash today. They should clearly know how to code, in assembly, animation and transitions. Use of a timeline is for losers. The creative process should always be sacrificed for knowing the code inside out. /sarcasmoff
    4. Re:C++ long-in-the-tooth? by suv4x4 · · Score: 5, Interesting

      If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!

      Firefox's problem is architectural and not one of garbage collection.

      XUL is inherently single-threaded and JavaScript based. Try out any XUL application out there and you'll see how you get the same poor performance, speed and resource usage as with Firefox (try Miro Player and Joost).

      The Firefox developers are literally throwing out more C code with every release, replacing it with JavaScript code.

      Leaks (in the classical sense) aren't what's causing Firefox's abysmal performance, and this is why Firefox 2 performs worse than Firefox 1.5, despite one of the "features" of Firefox 2 was supposedly plenty of fixed memory leaks.

      Actually I'm pretty sure they're in denial as to the cause of their problems. Announcing they're working on fixing "memory leaks" just supports their ability to continue their delusion.

    5. Re:C++ long-in-the-tooth? by SheldonYoung · · Score: 1

      Your argument is nonsense. If what you said held true, large scale applications should be able to be written is assembler. Without high level tools it wouldn't be feasible to create applications the scale we do today.

    6. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      That's right. You write crap, so you blame the language. If you can only write good code in Java, maybe you and your buddies should dig ditches for a living. Leave the software to the experts.

    7. Re:C++ long-in-the-tooth? by TuringTest · · Score: 1

      What's so special about memory management that you can't encapsulate it in a dedicated module, and abstract it away in the form of, say, a garbage collector?

      --
      Singularity: a belief in the "God" idea with the "demiurge" relation inverted.
    8. Re:C++ long-in-the-tooth? by Rei · · Score: 1

      My notion is that if you're finding yourself doing a lot of new/delete statements, it's about time that you considered using smart pointers instead. Why should you have to remember to deallocate memory every last time you outscope some object when you can have the object do it for itself?

      --
      Ever since, I've been suspicious of Jesus and very careful around chlorine.
    9. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 5, Insightful

      Perhaps the culprit is C++. Languages with auto-garbage-collection or are database-engine-based tend to clean up automatically or cache to disk more effectively.
      Actually, the big language culprits would be those with auto-garbage collection, etc. as they tend to have lazier programmers that don't "need" to manage their own resources, and in some cases even prohibit the programmer from being able to manage their resources.

      C/C++ and similar languages, on the other hand, force the programmers to manage their resources. In those cases, the programmers would likely be just not designing their programs well, or employing bad resource management. Yes, managing resources can be hard - one project I worked on had to go through several months of testing to get the resources properly managed, and even then some of the resources were still a little uncontrollable due to legacy code or Windows APIs, but overall the thing was pretty stable and any memory leaks were mostly due to Windows APIs.

      In either case, I can't tell you how many times I have heard (especially from Java programmers) something along the lines of the following: "RAM is cheap", "processors are getting faster", "computers will be ready for this when we deliver it", "hardware is cheaper than programmers"

      No offense, but to rely on hardware always being getting faster, or the cost of adding more RAM always being cheaper, etc. is a bad premise to rely on. Already with multi-core processors we are seeing slower processors being combined into a single processor get the equivalent processing power of a faster processor (e.g. two 1.8 Ghz cores rated equally to a single 3 Ghz core); thus the premise breaks down. Also, I want to be able to do more with the faster processors and additional RAM, rather than simply do the same job I could do yesterday only in "better" software.

      The real answer is doing your job right, and using the right tool - which is not necessarily the easiest tool to use either. We also need to get back to writing applications that have good, if not great, performance with minimal resource requirements (e.g. RAM and processor). If we're not going this at the API/library level - at the very least - then the programs and library/APIs that rely on that API/library level will have worse performance no matter what they do. But in either case it doesn't get done unless the programmers do their job, and use tools that allow them to do it.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    10. Re:C++ long-in-the-tooth? by caerwyn · · Score: 3, Insightful

      Or perhaps they're too busy thinking about clearly-defined objects, robust interfaces, clean documentation and the "big picture" then to worry about moving individual bytes around.

      Actually, I'd say they're not busy enough- if they actually had been, proper memory management should simply fall into place on top of a clean architecture. If you're trying to shoehorn memory management back into something that didn't support it before, you're going to have issues- and this applies whether you're doing c/c++ style management, reference counting, or garbage collecting.

      --
      The ringing of the division bell has begun... -PF
    11. Re:C++ long-in-the-tooth? by Yahma · · Score: 1

      A poorly programmed Java application can leak memory too. The culprit is likely not C++; the culprit is more likely poor programming practices or programming errors.

    12. Re:C++ long-in-the-tooth? by Kristoph · · Score: 4, Insightful

      A computer, by definition, 'moves bytes around'. One might argue that this is the job of the computer (or language or VM or whatever) and not programmer but if you don't understand how / why and when the bytes are moved around then you are a poorer programmer for it.

      C++ yields superior performance and memory usage, than higher level languages, in the hands of a skilled C++ programmer and it can lead to bloatware in the hands of a novice.

      There is this old saying about blaming your tools for a poor job and it applies to software development too.

      ]{

    13. Re:C++ long-in-the-tooth? by gcauthon · · Score: 1

      As a programmer, it is your job to think about both aspects. Anyone can think about the "big picture" after spending a year or two at ITT Tech. Real programmers make the big bucks because they can translate that "big picture" into an algorithm that "moves individual bytes around". Good programmers make even more money if they can do this without crashing the system or running it low on memory while following a strict time schedule.

    14. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      I think you belong to management. Micro management.

    15. Re:C++ long-in-the-tooth? by Kristoph · · Score: 1

      I disagree. You can, in fact, write any piece of software in assembler. The obvious advantage is that it would be much smaller and faster than any other solution. The challenge is that this would be time consuming and would require a very skilled team of developers to do correctly. This would, in turn, drive up cost dramatically.

      In other words we build software with increasing higher level languages not because it is not possible to build software with lower level languages but because it much cheaper to do so.

      ]{

    16. Re:C++ long-in-the-tooth? by Oswald · · Score: 1

      I agree with all of your comments about not wasting computing resources, but I'm not sure they are apropos. Firefox is not written in Java. Firefox is written in C++.

    17. Re:C++ long-in-the-tooth? by i7dude · · Score: 4, Insightful


      Your argument is nonsense. If what you said held true, large scale applications should be able to be written is assembler. Without high level tools it wouldn't be feasible to create applications the scale we do today.


      Wrong. What he is saying is that people who choose to use C/C++ for their applications should be competent enough to properly handle their own allocation and de-allocation of memory. If your abilities as a programmer preclude you from properly managing your application's memory then you need to look at alternatives that will take care of that for you.

      There are plenty of languages out there that offer things like garbage collection. Developers need to make better choices about which tools they use to meet their needs, and also understand their limitations and work within those parameters.

      dude.

    18. Re:C++ long-in-the-tooth? by Rei · · Score: 1

      Amen to that. I get that exact same mantra from Java developers all the time. And, unsurprisingly, amazingly simple programs end up amazingly bloated. Most tomcat apps, especially, are great examples of this.

      And another thing about Java: for a "cross-platform language", it really has an awful lot of problems running between different versions of itself. Sun Java or not? 1.4, 1.5, or 1.6? I once even had to use a program that had a compatability issue between 1.4.2_04 and 1.4.2_07! I'm not just talking about forward compatability, but backwards compatability as well, forcing me to keep multiple versions of Java on my system as a consequence. It doesn't give me a very good impression of the language.

      If your concern is memory leaks, just use C++ and smart pointers.

      --
      Ever since, I've been suspicious of Jesus and very careful around chlorine.
    19. Re:C++ long-in-the-tooth? by Constantine+XVI · · Score: 3, Informative

      Sorry, but quite a few other browsers (Opera, Konqueror, Safari(the WebKit part anyways)) are written in C++, and they don't seem to have near the problems Firefox has.

      --
      "I think an etch-a-sketch with an ethernet port would beat IE7 in web standards compliance."
    20. Re:C++ long-in-the-tooth? by Tablizer · · Score: 1

      If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!

      Assembler programmers used to make the same claim. I am not saying better languages will make bad programming go away, but they may take some of the pain out of decent programming such that people may be more willing to to help out. OSS depends on volunteers, and the more that can be done per volunteer, the better the software will be.

      (As far as Java, some complain that it should allow more "hints" about when and where to do GC rather than rely on the run-time engine alone. That seems like a good compromise.)

    21. Re:C++ long-in-the-tooth? by jsebrech · · Score: 5, Informative

      XUL is inherently single-threaded and JavaScript based. Try out any XUL application out there and you'll see how you get the same poor performance, speed and resource usage as with Firefox (try Miro Player and Joost). ...

      Actually I'm pretty sure they're in denial as to the cause of their problems. Announcing they're working on fixing "memory leaks" just supports their ability to continue their delusion.


      They're not in denial. They're working on tamarin, a replacement/upgrade of their javascript engine based on the same engine that's in flash 9 / actionscript 3.

      Tamarin will run javascript 2, which will to do javascript what the move from actionscript 2 to 3 did for flash/flex. In short: it will make non-toy applications easily done, instead of just marginally feasible. They plan to migrate the firefox UI and extensions to javascript 2, which should negate the performance issues. Only problem: it won't be ready for FF3.

    22. Re:C++ long-in-the-tooth? by ultranova · · Score: 3, Insightful

      If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!

      Statements like this are why I prefer Java programs to C ones. Mandatory bounds checking means that no macho idiot can turn it off, no matter how full of hubris he is. But even assuming a 100% perfect coder, does it really make sense to use his precious time to worry about memory management when the computer can do that automagically ?

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    23. Re:C++ long-in-the-tooth? by twbecker · · Score: 1

      I'm not seeing the connection between architecture and memory leaks, particularly in a language like C/C++, where simple and subtle coding errors (that have nothing to do with architecture) can make all the difference.

      --
      "The problem with internet quotations is that many are not genuine" -Abraham Lincoln
    24. Re:C++ long-in-the-tooth? by Hatta · · Score: 4, Insightful

      Likewise, I don't trust any artist using Flash today.

      That's a good instinct. Never trust anyone using Flash.

      --
      Give me Classic Slashdot or give me death!
    25. Re:C++ long-in-the-tooth? by SheldonYoung · · Score: 1

      Exactly my point. And on the scale of applications the size of Firefox, OpenOffice or any other reasonably large application it would take an impossible amount of time and money to create them in assembler. Ergo, it's not feasible. High level tools make larger software possible, and automatic garbage collection is one of those tools.

    26. Re:C++ long-in-the-tooth? by arth1 · · Score: 2, Insightful

      My notion is that if you're finding yourself doing a lot of new/delete statements, it's about time that you considered using smart pointers instead.

      My notion is that if you find yourself doing a lot of new/delete statements, it's about time you considered using a programming language that gives you fine-grained and direct control.

      Why should you have to remember to deallocate memory every last time you outscope some object when you can have the object do it for itself?

      Because a routine can still be called that may access the object, so it can't be deallocated? A compiler has to err on the side of caution, but that's an err nonetheless.

      A human can know whether an object is truly never going to be called again, whether it's highly unlikely to be called again and so inexpensive to recreate that a special case recreating would be better, or whether it's not used right now, but so expensive to recreate that you want it to stick around anyhow. And other tidbits of information about the program and its IO and data that a compiler or interpreter just doesn't have.

      Garbage collection can make a mediocre program more robust, no doubt about it. But it comes at the price of bloat, and will never match the efficiency of a well designed program where the programmer is in full control.
    27. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      clearly-defined objects, robust interfaces, clean documentation and the "big picture"

      If they'd used such high level (not really) features as shared_ptr, references and the STL, then memory leaks are surprisingly difficult to shoehorn in.

      The moment you stop thinking in C and move onto true C++ (not the C-with-classes most people produce), memory leaks become a comical memory.

      See http://www.research.att.com/~bs/bs_faq2.html#memory-leaks

    28. Re:C++ long-in-the-tooth? by The+New+Stan+Price · · Score: 0

      If your concern is memory leaks, just use C++ and smart pointers.

      Tell that to the Firefox developers.

      Switching JVM versions is like switching processors, OS versions, and/or hardware. We had a C program executable that wouldn't work with a new minor version of Red Hat Linux. We also couldn't take that C executable and run it in windows or the Mac. Java wins hands down as far as that stuff goes.

      Object oriented languages that are high level result in lots of objects being created, regardless of garbage collection. Bloat drives RAM, hard drive, and processor prices down, so I'm not complaining.

    29. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      That's right. You write crap, so you blame the language. If you can only write good code in Java, maybe you and your buddies should dig ditches for a living. Leave the software to the experts. To be fair, you almost need the knowledge equivalent to a Ph.D. to be able to program C++ effectively. As one example, it took until the mid 90s before C++ programmers figured out how to safely implement exceptions! Scott Meyer's Effective C++ books give excellent examples of where actions that would be trivial in any other language require intense thought and a lot of experience. Even simple assignment operations require an incredibly in depth understanding of the language (copy constructors, destructors, overrides of operators, etc.). Add STL or a non-standard library onto that and you need a lot of knowledge. Honestly, you can't just take some recent CS grad and expect him to code C++ without making tons of memory leaks. Even the operations of of new and delete require a lot of in depth knowledge. To program C++ effectively you probably need 20 times as much knowledge as you would to program C. In contrast, you would probably only need to know twice as much knowledge as C to program Java.

      I like C++ for its power and speed (only 5% slower than C), but I wouldn't want anybody with less than 10 years of experience in programming making production code in it.
    30. Re:C++ long-in-the-tooth? by dhasenan · · Score: 1

      And when everyone finds themselves writing a lot of new/delete statements, it's about time they start using a language that has smart pointers as the default option (or at least as an option that's just as easy as regular pointers).

      Well, that's one thing that Java did and got right, as much as it pains me to praise the language.

      Of course, if you're allergic to garbage collection by default, you could have a garbage collector that you link in during debug mode that records everything it collects, along with a stack trace showing where it was allocated. That will show you very quickly where your memory leaks are.

      There are valid reasons to want to avoid garbage collection. Mainly that it's an action that takes place at uncontrolled intervals and takes an unbounded amount of time to complete.

    31. Re:C++ long-in-the-tooth? by cnettel · · Score: 1

      Smart pointers are still a smart thing, for all those cases where it really is so simple that it's ok to deallocate when you leave the current scope. It won't stop you from fine-grained control in all the cases where "real" memory management is needed, rather than some simple scratch space that you don't want to allocate on the stack.

    32. Re:C++ long-in-the-tooth? by mce · · Score: 2, Informative

      I agree with both of you. But I'd like to point out that Firefox has garbage collection mechanisms built-in, written in C++. But, as it turns out, garbage collection is not as simple to write as one might think and the presence of garbage collection support makes people lazy, also in C++. And of course, especially in C++ this is a Bad Thing (TM). Lazy programmers quickly start assuming that malloc() and strdup() are auto-collected as well.

      Garbage collection in C++ is especially tricky, actually, because a single forgotten pointer "at the broder of the collection scope" can prevent many megabytes of interlinked "garbage collected" data structures from being detected as a loop and hence collected for real. Everybody assumes that the whole thing will auto-die and writes code accordingly, allocating like hell and not caring about resources; nobody is aware of the fact that somewhere in one single file a pointer assignment might be missing that blows their collection dreams out of the water.

    33. Re:C++ long-in-the-tooth? by jellomizer · · Score: 3, Insightful

      I am not sure where you think C++ Programmers are more careful the Other Higher language programmers. A lot of C++ Programmers are really not that good the only reason they use C++ because they had to take it part of their college requirements, thus being the only language they know. Problem with C++ is the fact programming memory is so intensive that most people will be willing to let it leak because of all the extra work it will take to clean it up. They program in C++ not because it is the best tool for the job but the one they know the best. I have seen cases where C++ Project get killed because they take way to long to write and more to debug, while Python, VB or Java Programmers seem to get the job done. Most projects are not Open Source, Most programming is actually just custom program for businesses so these programmers are paid by the hour.

      I Agree with you the Duel Cores are not equal to systems with twice the GigaHertz and the singlecore twice as fast system normally will out preform the application written. But that isn't about C++ Program or Java Programming, It is about Multi-Threaded programming. Parallel processing is a different form of programming that most programmers shy away from. But still the fact if you are paying a programmer $20 and hour and it takes them twice as long to get a 10% increase in speed it would be better off buying extra RAM then paying the programmer.

      Now if you are getting a boxed application that is different because the cost of application development programming is spread across all the people who buy it. So by Doubling the price of the Shrink Wrapped App. say from $80 to $160 and everyone gets a 10% increase in speed then it is worth it to put the extra in and get it more optimized, the degree of benefit will outweigh the costs.

      The thing that usually gets me like comments like this parent it assumes a completely Academic Computer Science approach to all problems. While real life requires making trade offs and sacrificing performance is often a good trade off to make because most of the time it is unnoticeable, most computers spend most of their time idle anyways, and most application are idle waiting for inputs. So in the once in a while heavy processing moment say in this case an HTML Render adding 1 second to the load in real life most people wont notice unless they are going back and forward button crazy. Or doing a batch rendering job. As for memory I am surprised that you didn't bring up the large quanity of 32bit systems still out there being sold as new only handling a max of 4 GB or RAM so for a large population RAM limits are an issue again.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    34. Re:C++ long-in-the-tooth? by nwf · · Score: 1

      Java has automatic garbage collection and many applications still leak! Eclipse is a good example. I do Java Servlet development using Eclipse and WST. I can't do serious development for more than about 6 hours without Eclipse running out of RAM and promptly either freezing up or exiting. GC is no panacea. Sure it can make some things easier, but if the programmer has the code hold onto things that will never be used, GC won't help.

      Another example: at my previous job we used Java to create applications (no web stuff, just plain CLI apps.) GC became the problem because of the high allocation rate. Rewriting in C++ where we used smart pointers improved the performance 2-3x, mostly owing from the lack of GC and copious use of stack-based objects. Memory leaks were few and far between for us owing to a good architecture.

      --
      I don't know, but it works for me.
    35. Re:C++ long-in-the-tooth? by Wolfier · · Score: 1

      Professional computer programming, perhaps. Professional software engineering, definitely not.

    36. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 1, Insightful

      I can't tell you how many times I have heard (especially from Java programmers) something along the lines of the following: "RAM is cheap", "processors are getting faster", "computers will be ready for this when we deliver it", "hardware is cheaper than programmers"
      Depending on the context in which this is said, it can be a reasonable statement (even though these sounds suspiciously like somewhat fabricated quotes to further your argument).

      If this is said in the context of writing an application, desktop or otherwise, that is intended to be run by someone other than the programmer or his immediate organization, then it's a terrible approach to the problem. But if you're writing an app that is intended to run solely on your company's application servers, it's perfectly reasonable to say that developer time costs more than the number of app servers or extra ram that it would take to deal with the quick-and-dirty solution. When you have application servers behind a load balancer, you're basically able to add application servers as the need arises. There isn't the same need for tightly-coded, memory-efficient code that there is when you're code is being run by third parties.

      None of this is an excuse for sloppy programming that could easily be done better with not much more effort. But if the effort do it in a resource-efficient manner really is significantly more than it is to do it in a simpler fashion, then it's perfectly reasonable to pick the easier route.
    37. Re:C++ long-in-the-tooth? by caerwyn · · Score: 1

      It's a question of the type of memory issues that arise. If you have a minor memory leak in a simple function in the context of a good architecture, both finding and correcting it should be trivial. If you've spent proper time in the architecture to account for memory management, you should have architected in solutions to application-level memory management, leaving only low-level management to be a source of problems- where those problems are not difficult.

      Basically, not all memory leaks are created equal. Correct architecture prevents the "hard" classes of memory leaks, leaving the "easy" classes that are really no more difficult to find/fix than anything else.

      --
      The ringing of the division bell has begun... -PF
    38. Re:C++ long-in-the-tooth? by Tibixe · · Score: 1

      Use Haskell. It's a purely functional language, so no variables, no garbage, nothing to worry about :)

    39. Re:C++ long-in-the-tooth? by Just+Some+Guy · · Score: 1

      Assembler programmers used to make the same claim.

      Ignoring, of course, that assembler still sits comfortably above machine language and microcode, both of which are at a much higher level than the gate logic that defines them. All this whining about "your arbitrary abstraction level is clearly inferior to my arbitrary abstraction level" is just silly.

      --
      Dewey, what part of this looks like authorities should be involved?
    40. Re:C++ long-in-the-tooth? by Doctor+Crumb · · Score: 2, Insightful

      All of the best programmers I know are lazy; it's the well-meaning hard-working ones who duplicate functionality, write large fragile functions to solve a single case of a generic problem, and who create difficult and obscure interfaces. Laziness encourages you to let the computer do those things that it is good at, encourages code re-use, and encourages using built-in features wherever possible.

      The only case where you should be managing your own memory is in embedded programming or high-performance applications. Since TFM is about a *web browser*, neither of those apply. It doesn't really matter to the average person whether firefox leaks memory or not; they care if it is able to correctly render their homepage. It's a smart move for FF to have concentrated on Getting It Working first, since that's the constraint that will actually determine their product's success or failure.

    41. Re:C++ long-in-the-tooth? by flyingfsck · · Score: 1

      Note that even GNU GCC uses a garbage collector. There is nothing wrong with using a machine to handle memory management and with C++ it is the only reliable way.

      --
      Excuse me, but please get off my Pennisetum Clandestinum, eh!
    42. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 1, Interesting

      Actually, the big language culprits would be those with auto-garbage collection, etc. as they tend to have lazier programmers that don't "need" to manage their own resources,

      People keep saying this. I wonder if it's true -- I haven't seen any evidence of it. I've seen lazy/stupid programmers in all kinds of languages. Wouldn't the same argument work just as well against memory protection, and preemptive multitasking, and compilers?

      and in some cases even prohibit the programmer from being able to manage their resources.

      That's a problem with your specific GC, not a problem with GC. JWZ even ranted about this. You hear Java users complaining about memory, and Java programmers bitching about the GC, but you never hear Lisp programmers bitching about their GC. Any production Lisp GC gives the programmer far more control than Java's does. Hearing people rant against GC is like hearing Yugo owners rant that automobiles suck.

      C/C++ and similar languages, on the other hand, force the programmers to manage their resources.

      No, they don't. How would they? If I forget to free something and it goes out of scope, bang, memory leak. How am I forced to do anything about that by the language? (I've heard more than one story about somebody who learned Java, and then went back to writing C++, and wrote many lines of code before remembering that their C++, while correct, leaked left-and-right.)

      I want to be able to do more with the faster processors and additional RAM, rather than simply do the same job I could do yesterday only in "better" software.

      You're right. The easiest route to fast, working software is to get it correct, and then tune for performance -- and GCs are great for that.

      We also need to get back to writing applications that have good, if not great, performance with minimal resource requirements (e.g. RAM and processor). [...] But in either case it doesn't get done unless the programmers do their job, and use tools that allow them to do it.

      Again, you're right. And these requirements just scream "we need a GC that doesn't suck".

    43. Re:C++ long-in-the-tooth? by edxwelch · · Score: 1

      > in some cases even prohibit the programmer from being able to manage their resources.

      There you have hit the problem with garbage collection.

      A lot of people don't realise that it's easier to have memory leaks with languages with garbage collection. In a complicated program typically each object is referenced by dozens of other objects and you have to carefully check that each one is nulled out, otherwise you will have "unintentional object retention". In c++ a well designed program will have a clearly designated owner of each object, which is reponsible for deleting the object.

    44. Re:C++ long-in-the-tooth? by dhasenan · · Score: 1

      If you use a garbage collector, you're deciding that it's worth a small performance penalty and a memory footprint that's slightly higher than optimal, and in exchange having vastly fewer memory leaks than is otherwise likely.

      Well, sometimes not that small. You have to keep in mind that collection is far from free. At a conference I attended recently, there was a talk on avoiding garbage collection strain with certain applications using array slicing -- which basically works out to pointer aliasing, with the caveat that the alias can fall anywhere in the range allocated to the original pointer.

      Still, I'd rather work with a garbage collector than without. I can be clever and use those techniques to reduce the work that the collector has to do, but if I screw up -- and no matter how good I am, I will; and when I do, it's going to be damned hard to find -- the garbage collector will take care of that.

      For you, try a garbage collector that records a stacktrace for each allocation, and when it collects, log how much memory was allocated and where. Much faster and easier than hunting down memory leaks manually.

    45. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      I'm so tired of hearing that C++ is the greatest thing since sliced bread. Yes managing memory makes it so that you are aware of that is being allocated, but that doesn't stop you from being an idiot and allocating everywhere and not freeing up any of it. I've seen both great Java and C++ code AND terrible Java and C++ code. Sure Java lets you get away with being lazier, but that doesn't mean there isn't terrible C++ code out there.

      I agree that we all need to simply be better programmers, but that isn't going to happen until we hit the hardware wall. And the world needs programmers to do things and do it quickly. Some people are willing to live with memory leaks as long as they have the app. If the app is saving the company millions but it requires a restart every night, they are going to pay an engineer to do it because the trade off is worth it. A company won't pay to have a minor problem fixed it they are barely going to notice the improvement.

      So what the heck am I trying to say? If it ain't broke don't fix it and the squeaky wheel gets the grease. We will be crappy programmers until we are FORCED to be better programmers. I love computer science dearly, but I'm not so delusional to believe that each and everyone us wants to write great code, has the ability to write efficient code or even likes coding a little.

      Get your C++ elitism out of my face! Because if you think if all java (auto-garbage collection) programmers suddenly became C++ programmers, then all memory leak problems would be solved, I've got a bridge to sell to you.

    46. Re:C++ long-in-the-tooth? by Dancindan84 · · Score: 1

      Those languages that have automatic cleanup also tend to have a larger memory footprint in the first place. There's a reason C++ is around. When coded -properly- it is faster and more efficient than these magical languages you speak of.

      --
      "Always forgive your enemies; nothing annoys them so much." - Oscar Wilde
    47. Re:C++ long-in-the-tooth? by JackMeyhoff · · Score: 1

      The culprit is the designer choosing the wrong tool for the job. C++ is a SYSTEMS language where you want control of memory allocations at that level, not applications language where you don't need this kind of control.

      --
      http://www.rense.com/general79/wdx1.htm
    48. Re:C++ long-in-the-tooth? by multipartmixed · · Score: 1

      > What's so special about memory management that you can't encapsulate
      > it in a dedicated module, and abstract it away in the form of, say,
      > a garbage collector?

      You're kidding, right?

      The ONLY garbage collector that sort-of works the way you're suggesting -- and I mean ONLY -- was written by some guys at macromedia with extremely brass balls. I mean, big ones, that hit your knees when you're walking and trip you if you're trying to run fast.

      Download the source for Tamarin. You'll see what I mean.

      In the meantime, think about this ONE problem: How can you tell in C if a pointer points to memory which can safetly be freed?

      --

      Do daemons dream of electric sleep()?
    49. Re:C++ long-in-the-tooth? by e2d2 · · Score: 1

      You know everything you said would be true, IF our job was to squeeze the last bit of performance from a machine. But it's not. Our job is to enable the user. A programmer focusing on low level bit shifts, memory storage, string management, etc, takes his eyes off the truly "big picture" and that's the domain you are focusing on and the "business" problems there in.

      Our users want results that provide them with real value, if performance is part of that value then so be it. Use the proper tools for the job.

    50. Re:C++ long-in-the-tooth? by dgatwood · · Score: 3, Insightful

      Precisely. A skilled craftsman does not blame the tools. A skilled craftsman does the job right, and if it cannot be done right with the tools at hand, he/she goes and gets tools that are appropriate for the job.

      Poor programming is possible in any language, and garbage-collected languages are no exception. I would also caution that garbage-collected languages tend to encourage more novice programmers because of the apparent ease of use (it isn't really easier). This results in a larger number of poorly-written apps by people who think they know how to write software. Taking away the need to explicitly manage memory just encourages lazy programmers who can always find something else to be sloppy about.

      As for garbage collection making this sort of thing magically go away, that simply isn't the case. Working around garbage collection with things like "soft references" is a disgusting hack and is actually far harder than simply doing explicit memory management in the first place. Anyone who says differently has never had to manage any complex data structures that reference each other in non-trivial ways. The alternative is to basically write your own code that explicitly walks the data structure, deleting circular references, etc. If you're going to that much trouble, you are doing just as much work as you would for explicit memory management, but without the performance benefits from actually being able to destroy the objects immediately, and thus garbage collection is just hurting performance without providing any real benefit.

      Basically, apart from the really trivial cases (most of which could be solved just as easily by simply creating a stack-local auto-destroy variant of malloc), garbage collection causes more problems than it solves. In my book, garbage collection in programming language ranks right up there with multiple inheritance as one of the worst ideas ever conceived.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    51. Re:C++ long-in-the-tooth? by BZ · · Score: 1

      > Since TFM is about a *web browser*, neither of those apply.

      Actually... a web browser _is_ a high-performance application. You should see the rendering tasks that web sites toss at it and expect it to perform quickly and perfectly

    52. Re:C++ long-in-the-tooth? by Wavicle · · Score: 1

      C++ yields superior performance and memory usage, than higher level languages, in the hands of a skilled C++ programmer

      OMG! Newsflash: lower level languages more lean and efficient than higher level languages. News at 10!

      Lower level languages take more time and skill than higher level languages, resulting in increased developer costs and longer time to market. News at 11!

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    53. Re:C++ long-in-the-tooth? by dgatwood · · Score: 1

      That's a load of crap. People used to create full-featured applications in assembler all the time. The initial transition to higher level languages like C was mainly for portability, not for ease of programming; it's almost as easy to code something in asm as it is to code it in C, provided that your assembler supports certain critical features like labels for jumps and load/store addresses. The move towards higher level languages for ease of programming is a much more recent thing.

      Back in college, I wrote 30+ pages of x86 asm in about 8-10 hours, complete with complex data structures, user input via BIOS, etc. It really isn't as hard as people make it out to be. It just isn't very portable, and thus isn't very practical for most purposes.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    54. Re:C++ long-in-the-tooth? by fwarren · · Score: 1
      The real answer is doing your job right, and using the right tool - which is not necessarily the easiest tool to use either. We also need to get back to writing applications that have good, if not great, performance with minimal resource requirements

      A primer on this subject Thinking Forth.

      --
      vi + /etc over regedit any day of the week.
    55. Re:C++ long-in-the-tooth? by dgatwood · · Score: 1

      In my day, we called that a stack variable. I don't see anything "smart" about it.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    56. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 2, Insightful

      I am not sure where you think C++ Programmers are more careful the Other Higher language programmers.
      It's not that they are more careful - but to write a successful large program in C or C++, you have to manage your resources. If you don't - then the OS will kill the process as you will SEG Fault/etc. So, unless you are only writing small programs - like for a typical high school or college level class project - you have to manage your memory. (Even then, you have to to some degree.)

      A lot of C++ Programmers are really not that good the only reason they use C++ because they had to take it part of their college requirements, thus being the only language they know.
      The only reason a lot of folks use Java is because they learned it in college. Doesn't make them good programmers. Some vo-tech schools only teach .Net - VB before that - and the same thing resulted. This can be said about nearly any language. The trick is in the student that is able to learn multiple languages and take steps beyond that - otherwise, they'll never be a really good programmer. (I usually recommend people to learn at least three languages - a C family language, a Basic family language, and a Modulus family language - as well as some scripting languages. This puts them in different enough programming environments, with languages that are different enough from each other that it really does force some learning that goes above and beyond a single language.)

      Problem with C++ is the fact programming memory is so intensive that most people will be willing to let it leak because of all the extra work it will take to clean it up.
      You can say that about any language really. The problems might change a little bit, but the base problems are still there. Java programs end up as memory hogs because you can't manage your memory - it's left to the GC - and many programmers write in Java because it is all they learned in college; and regardless of whether or not they want to lower the memory by managing it, Java doesn't provide the tools to do so.

      That may not be the case for all GC languages, but it is the case of what is perhaps the most prominent GC language - Java, which also has had the unfortunate aspect of being forced on a lot of companies because the programmers they could hire out of college didn't know any other language. (Sad reflection on the colleges and universities they came out of too - but that is also partly due to vo-tech colleges as well, where training is typically limited to the quick & dirty.)

      The thing that usually gets me like comments like this parent it assumes a completely Academic Computer Science approach to all problems. While real life requires making trade offs and sacrificing performance is often a good trade off to make because most of the time it is unnoticeable, most computers spend most of their time idle anyways, and most application are idle waiting for inputs.
      In no way was I assuming a quot;completely Academic Computer Science approach to all problems" - in fact, a lot of Academic Computer Science is strongly behind the GC languages and not teaching students how to manage resources.

      What I am talking about is doing proper engineering of software - proper design, architecture, and implementation - such that the resources are managed in the program appropriately. It really is not a hard job to do, and when done - it can speed up implementation and debugging as it all works towards it in the end.

      By doing the rag-tag job that Academic Computer Science pushes, debugging will be long and hellish, and will only add to cost over-run.

      Additionally, I am primarily pushing management of resources in this thread, including memory. When it comes to performance, then yes - you need to run a profiler and optimize the program accordingly and not spend all your time on optimizing every line of code throughout the entire program.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    57. Re:C++ long-in-the-tooth? by dgatwood · · Score: 0, Troll

      I'm probably replying to a troll, but here goes. What you're saying is that you need the equivalent of a Ph.D. to program in C++ poorly. Exceptions and STL are disgusting and shouldn't even be part of the language, IMHO, and their overuse is a good way to spot a novice programmer. It is precisely the horrible nature of exceptions that is the reason it too so long for them to become usable.

      There is nothing that an exception can do that can't be done better with either A. returning reasonable error codes up through the stack (where they might be handled in a useful or interesting way at some point in the future) or B. calling a die() routine if the failure truly is something that truly can never be handled. All exceptions do is make it harder to figure out how you got from point A in the app to point B by suddenly tearing down the entire stack in-between unceremoniously, and simultaneously discouraging the use of cleanup routines at every step along the way, thus encouraging bad code.

      Every piece of code I've ever seen with exceptions has been a total mess, and all of them have eventually been rewritten to not use exceptions and suddenly worked a lot better. This isn't a case where more knowledge of how to write code with exceptions helps much, but rather a case where the programmers would have been better off had they never learned that aspect of C++ at all.

      STL is just a pile of syntax that basically does what we used to do with void * pointers, just without the flexibility and programmer control (albeit with the possibility of a bit more type safety checking). I have yet to see a single situation where anyone used templates that could not have been done nearly as easily and much more readably without them. It isn't evil, per se, but it is completely unnecessary to understand it as long as you don't have to use it, and the only reason you ever have to use it is if you inherit a project where somebody else used it to begin with.

      As for your comments about new and delete, using them correctly doesn't take a lot of in-depth knowledge. It's not that hard to remember that every time you create something, you must destroy it or you'll leak memory. If you can't figure those out, you should be sent back to school before being allowed to touch a single line of code.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    58. Re:C++ long-in-the-tooth? by gbjbaanb · · Score: 1

      Sometimes our job *is* to queeze the last bit of performance out of the machine, typically the desktop client-side apps don't care so much as you have RAM and CPU dedicated to 1 user, but the server is a different matter and requires a better approach. The user is not enabled if he has to spend seconds watching the cursor spin every time he clicks 'next'.

    59. Re:C++ long-in-the-tooth? by plague3106 · · Score: 1

      Bullshit. Its not different than using someone elses HTTP library instead of writing your own. You may want to spend time writing lots of needed, but non-productive code, but others of us want to more quickly build reliable applications.

      Garbage collection doesn't mean you throw good coding out, but it does save you from forgetting to delete an object in memory, an error that can be very difficult to track down and for which we have a reliable solution.

    60. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      I supposed you've added logical/functional programming there as well...

    61. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 1

      Actually, the big language culprits would be those with auto-garbage collection, etc. as they tend to have lazier programmers that don't "need" to manage their own resources,
      People keep saying this. I wonder if it's true -- I haven't seen any evidence of it. I've seen lazy/stupid programmers in all kinds of languages. Wouldn't the same argument work just as well against memory protection, and preemptive multitasking, and compilers?
      Perhaps it is because by having a GC, it encourages the programmer to ignore managing their resources - thus they become more lazy than they would have otherwise. There are certainly lazy/stupid programmers in all kinds of manners, but resource management shouldn't be one of them, and we shouldn't be putting "features" into languages to mitigate the failures of the lower eschelons of its programmers, especially if those "features" may increase they number of that lower eschelon.

      A lot can be learned about programming by managing ones resources, and the programs will get better for it too.

      and in some cases even prohibit the programmer from being able to manage their resources.
      That's a problem with your specific GC, not a problem with GC. JWZ even ranted about this. You hear Java users complaining about memory, and Java programmers bitching about the GC, but you never hear Lisp programmers bitching about their GC. Any production Lisp GC gives the programmer far more control than Java's does. Hearing people rant against GC is like hearing Yugo owners rant that automobiles suck.
      I'll give you that - and perhaps a good solution is to have the ability for the programmer do specify it even with the GC being there. However, at least for Java - there is nothing in the language itself that enables a Java programmer to even tell the GC that the memory block is available for de-allocation, the GC just has to guess and eat a lot of overhead to do it.

      As for Lisp programmers, they are few and are usually Lisp programmers by choice. I know I certainly wouldn't punish myself with Lisp. (Yes, I've programmed in Lisp before.)

      C/C++ and similar languages, on the other hand, force the programmers to manage their resources.
      No, they don't. How would they? If I forget to free something and it goes out of scope, bang, memory leak. How am I forced to do anything about that by the language? (I've heard more than one story about somebody who learned Java, and then went back to writing C++, and wrote many lines of code before remembering that their C++, while correct, leaked left-and-right.)
      You're forced to by the program not running for the required amount of time. If the program doesn't function, and crashes you'll have to track it down and fix it. You can make that easy on yourself, or hard on yourself depending on your approach; but having some algorithm follow you around and try to guess when you are no longer using a chunk of memory is not a solution - it's laziness.

      To make it easy on yourself, you'd design the program to have entities that would be responsible for the memory - both for its allocation and de-allocation. I've done this. It works, and no GC is required either.

      Moreover, I have written programs that stay up for a long time, and are good about their resources. And I'm done programs where I had to import legacy code that wasn't good and added such capabilities to them too so that they became good and solid - in the end, those programs were more solid than the OS, as the OS they were on was more likely to be rebooted before they would reach any kind of level that would be an issue.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    62. Re:C++ long-in-the-tooth? by maxwell+demon · · Score: 1

      The problem, of course, is that the computer cannot do it automagically. You can leak memory in a GC language just as easily. The only difference is what causes the memory leak: In non-GC languages it's forgetting to use free(), in GC languages it's forgetting to null every reference to that memory (or at least every reference which isn't itself in unreferenced objects).

      The problem GC solves is not memory leaks. The problem it solves are dangling pointers/references (i.e. if you have a non-null reference, with GC you are guaranteed it points to a valid object, while in non-GC languages it might point to a freed object, or even into some other object allocated later into the same memory).

      --
      The Tao of math: The numbers you can count are not the real numbers.
    63. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      How can you tell in C if a pointer points to memory which can safetly be freed The same way it works in garbage-collected languages, after all, they're typically coded in C.

      Really, you can overwrite the memory with a mask (eg 'deadbeef'), or allocate every block with a status byte beforehand. Then you can tell if the memory has already been freed, which is what you're thinking of.

      In C++ there are plenty of garbage collector classes, one has to suit your requirements.
    64. Re:C++ long-in-the-tooth? by Wavicle · · Score: 3, Insightful

      You realize, of course, you are seriously going against Slashdot groupthink here. Still, if I had mod points, I'd give you one. Macho programmers who think they are too awesomely skillful to screw up are the ones whose screwups always take me the most time to chase down.

      Frankly if you can't look at a problem and then pull out five or six languages from your tool belt and evaluate which will be the best for this job, then you are a bad programmer. Don't code in C++ that which could easily be done in Python. Don't code in Python that which could easily be done in Bash. If you don't have a compelling argument for using C, DON'T USE IT!

      Sometimes I think Java is awful for no other reason than companies tend to believe that using one language for other is a net gain. That has never been my experience except when your very best programmers aren't all that good either. If you insist that everything run on the Java runtime, use Jython and embed Python. A good example of multi-language gains can be seen with embedded Lua. There are many applications out there that use Lua "under the covers" so that things that do not have to be written in C++ aren't. This includes games (I believe WoW is one).

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    65. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 1

      If you use a garbage collector, you're deciding that it's worth a small performance penalty and a memory footprint that's slightly higher than optimal, and in exchange having vastly fewer memory leaks than is otherwise likely.
      Oh? A number of companies in recent years have been forced to switch programming efforts to Java due to only being able to get programmers that knew Java due to colleges & universities only training students in Java, or starting off students in Java, which then makes it harder for them to transfer to some other languages as some of the basics must be entirely retaught. (I've seen this; and I've heard complaints about it too.)

      And then you sometimes have a manager or client saying "this will be done in Java" because its what they want for some reason. Then you as the programmer are forced to use Java and may be unable to change their minds despite the downside of not being able to manage your memory, when you normally would.

      There are certainly reasons why people use things that go beyond the choice of choosing a GC. They may not have opted to for that higher memory footprint, or performance penalty, but were at the hands of someone else that didn't know any better and were unable to convince them otherwise.

      Your other points are of very true, and often overlooked by the GC-supportive crowd and Java supporters.

      Still, I'd rather work with a garbage collector than without. I can be clever and use those techniques to reduce the work that the collector has to do, but if I screw up -- and no matter how good I am, I will; and when I do, it's going to be damned hard to find -- the garbage collector will take care of that.
      I wouldn't say its "damned hard to find". I've done it in the past by having a small stack tracer I could use and turn on and off. I would use for debugging, and turn it off (removed from the compiled code) for production. But all it did was tell me where my memory leaks were. Worked pretty well, and the program it was used in was very solid. The only leaks I couldn't remove were OS API based. Additionally, it was very easy and quick to locate leaks on account of it.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    66. Re:C++ long-in-the-tooth? by tyrione · · Score: 1

      A 10" Hitachi Sliding Compound Miter Saw with the laser sighting has a slightly different approach to that of the 10" DeWalt Sliding Compund Miter Saw without the laser sighting. The operator is the same. Don't blame either saw [either programming language--you choose the languages for this analogy] when the dimensions are short or long or the ends aren't orthogonal/square, etc. Blame the operator.

    67. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 1, Interesting

      A computer, by definition, 'moves bytes around'.

      No. A computer, by definition, computes. At one level, this consists of moving bytes around. At another, it consists of moving bits around. At another, it's electrons flowing. At another, it's symbol manipulation. I'm a programmer, and even I don't care about bytes, or electrons; if Firefox worked by black magic, I would not care.

      If C++ is efficient, isn't assembly even more efficient? C++ isn't as good at dealing with individual bits as assembly. Won't somebody think of the bits?

      But even Linux is written in C, rather than assembly, today, even though Linus is skilled at writing assembly language. Is it less efficient now because it has less assembly than Linux 0.01 did? No, it's more efficient because Linus and friends can deal in useful abstractions. If you tried to write Firefox in machine code, you'd never finish.

      It sounds relatively safe to say "C++ yields superior performance and memory usage" because in one extreme case (say, an embedded system) it's true. You wouldn't use a GC there. But then, on a small enough system (say, 512 bytes of RAM) you wouldn't use a normal C library, either. There simply isn't room. Write your own. But this doesn't scale: on a gigabyte+ system, it's a net savings to use an existing (shared!) library for string manipulation, and it's a net savings to use an existing GC for memory allocation.

    68. Re:C++ long-in-the-tooth? by gbjbaanb · · Score: 1

      You don't even need a GC to keep track of stack traces, build in debug mode, and then take snapshots of your code. You can quickly see which bits are leaking as the allocation count from the same place will go up and up and up. Microsoft's UMDH is a good tool for this.

      Im not convinced GCs are good, if Java had better scope for objects, so the finaliser could be called deterministically for locally defined objects, then yes it'd be good. (a bit like IDispose hack that MS put into C#, but properly done with full language suport instead of being a bodged-on hack)(which reminds me of Finalisers in the first place - when I was first shown Java at a conference by IBM at Hursley Park it didn't have finalisers, everyone in the conference basically said "that's a bit pants", a few months later Sun bodged finalisers onto the language).

      The biggest problem with GC is that they only consider memory, no-one really stopped to think that it's used to clean up objects that hang on to more precious resources.

    69. Re:C++ long-in-the-tooth? by maxwell+demon · · Score: 1

      Why do you think a C++ programmer has to focus at low level shifts, memory storage, string management, etc? Maybe you are not aware that there's a standard library which liberates you from those needs?

      --
      The Tao of math: The numbers you can count are not the real numbers.
    70. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 2, Insightful

      You know everything you said would be true, IF our job was to squeeze the last bit of performance from a machine. But it's not. Our job is to enable the user. A programmer focusing on low level bit shifts, memory storage, string management, etc, takes his eyes off the truly "big picture" and that's the domain you are focusing on and the "business" problems there in.

      Our users want results that provide them with real value, if performance is part of that value then so be it. Use the proper tools for the job.
      Our job is to provide them with programs that work and function as expected and within a user-perceivable performance speck. Users have a perception of performance - and if that perception does not match what they want, then your program is in trouble, however hard that perception may be to achieve.

      As another commentor points out, it is very true that performance does matter. Servers software must be very responsive and server admins care very much about the user perception of their server's performance, and the perceptive performance of the services they render.

      However, while more tolerable on the user's desktop - it is still very important. User's don't like sitting around waiting for an application to become ready to use, or for an application to play catch up. That costs time, and for businesses that costs money. Simple things such as managing resources can often reduce that wait period to something more tolerable that isn't so costly but only when the programmer deploys such tactics and uses a language (GC'd or not) that allows them to do so.

      Ever have a user complain that your program didn't respond fast enough? One good example for you - in one network I am on, there is no reverse-DNS lookups and some other network basics are not provided, this results in some programs not responding (both IE and FF) for up to 5 minutes if I accidentally type in a bad URL. This results in a user perceived performance issue with the application (my first thought, until I could show that the same problem did not exist on another network with the same machine) as the application locked up - user interface was not usable, and would not be repainted, etc. while the software waited. Now IE and FF could mitigate this by pushing that DNS lookup into a worker thread. While this is one example of an external issue affecting internals to a software program, the basis behind the issue - user perceived performance problem - extends quite far.

      Few other examples - How often have you waited on MS Outlook to catch up with you? How often have to waited for MS Word to compete a task - that you didn't start - so that you could continue working on the document? How often have you worked on a document and had the computer stop responding to you while it finishes something else? How often have you upgraded Windows or Office to a newer version and end up having to upgrade the PC even though you didn't do anything different, and were not using any new features?

      A Pentium 75 with 32 MB RAM should be sufficient to do basic email; however, try to do it with most programs these days and the system will feel like it was bogged down, even though you could do that and run Office, and more when it came out back around 1995.

      Performance is a big thing, and the perception of performance is even bigger.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    71. Re:C++ long-in-the-tooth? by e2d2 · · Score: 1

      Actually I am well aware of those things being a C++ programmer myself. The Parent post referred to C++ as superior because it didn't provide these "crutches".

    72. Re:C++ long-in-the-tooth? by e2d2 · · Score: 1

      Yes, hence my line "use the best tool for the job". My job as a programmer is not to squeeze the most out of a machine, that's a byproduct of my abilities. My focus is always the domain and the user.

    73. Re:C++ long-in-the-tooth? by FnH · · Score: 1

      > If your concern is memory leaks, just use C++ and smart pointers.

      _now_ I'm concerned about memory leaks.

      Smart pointers don't solve all memory leaks/problems. Most don't detect circular references and even if they do (as Java's garbage collector does) everything still isn't fixed. People often forget to null out pointers no longer needed. While not technically a memory leak, it still eats all your memory.

    74. Re:C++ long-in-the-tooth? by ultranova · · Score: 1

      The only difference is what causes the memory leak: In non-GC languages it's forgetting to use free(), in GC languages it's forgetting to null every reference to that memory (or at least every reference which isn't itself in unreferenced objects).

      At least Java has weak references which do not prevent the object from being garbage collected and are auto-nulled when it goes, and optionally get added to a notify queue. Very useful for implementing collections :).

      The problem GC solves is not memory leaks. The problem it solves are dangling pointers/references (i.e. if you have a non-null reference, with GC you are guaranteed it points to a valid object, while in non-GC languages it might point to a freed object, or even into some other object allocated later into the same memory).

      But solving dangling pointers has the added effect of making memory leaks less likely to occur. Without GC you have no way of knowing if a particular object/memory area is referenced by someone else, and as such risk either a dangling pointer or memory leak no matter what you do. Yes, there are ways to work around this - strict policies on who "owns" the object, smart pointers with reference counting, etc - but they they are ultimately just bandaids. By making dangling pointers impossible GC removes the problem of when to free the memory, which makes memory management a lot simpler.

      This is especially important for open-sourced programs which tend to grow organically over time, with developers coming and going. If even one doesn't know about a particular memory area ownership policy, the end result is a bug. Of course the same is true for any large enough application: as soon as you have more than one programmer, there's a possibility that they fail to adhere to the same policy and cause all kinds of fascinating bugs.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    75. Re:C++ long-in-the-tooth? by peterpi · · Score: 1

      Mainly that it's an action that takes place at uncontrolled intervals and takes an unbounded amount of time to complete.

      Indeed. That's why I love C++'s RAII.

      Try this:
      Crash.java

      import java.io.*;

      class Crash
      {
                      public static void main (String [] args) throws java.io.IOException
                      {
                                      while (true)
                                      {
                                                      FileInputStream in = new FileInputStream ("Crash.java");
                                      }
                      }
      }

      Then:

      $ javac Crash.java

      $ time java Crash.java

      Exception in thread "main" java.io.FileNotFoundException: Crash.java (Too many open files)
                      at java.io.FileInputStream.open(Native Method)
                      at java.io.FileInputStream.(FileInputStream.java:106)
                      at java.io.FileInputStream.(FileInputStream.java:66)
                      at Crash.main(Crash.java:12)

      real 0m0.259s
      user 0m0.148s
      sys 0m0.048s

    76. Re:C++ long-in-the-tooth? by Rei · · Score: 1

      Smart pointers aren't constrained by having to be local.
      They're also faster than garbage collection, and a lot more predictable in behavior.

      --
      Ever since, I've been suspicious of Jesus and very careful around chlorine.
    77. Re:C++ long-in-the-tooth? by Hatta · · Score: 1

      They're not in denial. They're working on tamarin, a replacement/upgrade of their javascript engine based on the same engine that's in flash 9 / actionscript 3.

      You have to be kidding me. They're replacing the javascript (yuck) with FLASH (oh dear god no)?!?! Do they have an MPL licensed flash interpreter?

      --
      Give me Classic Slashdot or give me death!
    78. Re:C++ long-in-the-tooth? by RazzleDazzle · · Score: 1
      --
      ZERO ZERO ONE ZERO ONE ZERO ONE ONE! Just brushing up for my next big invention: Ethernet over Voice (EoV)
    79. Re:C++ long-in-the-tooth? by multipartmixed · · Score: 1

      C has no concept of a finalize/destruct, hence there is NO WAY (save the above Tamarin-referenced stack-walking machismo) to reclaim memory without the programmer instructing the program to do so. The C runtime simply does not have enough "knowledge" to implement garbage collection.

      For example, please explain how you would implement a garbage collector to catch this:

      [ecode]
      char *hello(void)
      {
          char *s = your_malloc(12);
          strcpy(s, "hello");

          return s;
      }

      (void)hello();
      [/ecode] ..that's right, there is NO WAY your_malloc() can *possibly* know that the memory returned to hello() is no longer needed for anything. The programmer MUST call your_free() on the value returned from hello().

      Now, it's certainly possible for the programmer to write something (that he calls) which helps to automate this. An excellent example is the memory pool allocation scheme used in APR (apache runtime). But, the programmer must call apr_pool_destroy() to destroy what he got from apr_pool_alloc(), or the program will (gasp) leak.

      Another -- completely different -- example is the garbage collector used to implement Spidermonkey. You could (if you were feeling totally insane) use it as a garbage collector for your C code. But none of your C program's memory would be freed once you rooted an object in the gc-thing tree, unless you did something to cause it to fall out of javascript scope. Again, the C programmer must take explicit action [albeit not necessarily on an alloc-by-alloc basis] to cause memory to be freed.

      --

      Do daemons dream of electric sleep()?
    80. Re:C++ long-in-the-tooth? by gd2shoe · · Score: 1
      In response to your rhetorical questions:

      Actually, the big language culprits would be those with auto-garbage collection, etc. as they tend to have lazier programmers that don't "need" to manage their own resources,
      People keep saying this. I wonder if it's true -- I haven't seen any evidence of it. I've seen lazy/stupid programmers in all kinds of languages. Wouldn't the same argument work just as well against memory protection, and preemptive multitasking, and compilers?

      No, no, and yes (sort of).

      Memory protection and preemptive multitasking are entirely different animals. Their job is not to help the programmer program the application to a working state. Their job is to protect the system from a bad (or hostile) program.

      Compilers do count to the degree that the writing programmer doesn't understand what the compiler is doing. One of the greatest disservices I have seen in college is the glossing over of how c++ code is translated into machine code. My first brush with what is actually going on was given to me by an upper-classman TA! The teachers themselves never have sufficiently covered the topic. The principle applies to other languages too, of course.
      --
      I won't join Slashcott. OTOH, If Beta goes live, I just won't be back until it's fixed. Sorry Dice.
    81. Re:C++ long-in-the-tooth? by chromatic · · Score: 1

      You can, in fact, write any piece of software in assembler. The obvious advantage is that it would be much smaller and faster than any other solution.

      Really? A program written in assembly is always faster and smaller than one written in a higher-level language? I can think of a couple of algorithmic improvements that aren't readily feasible in assembly language, especially related to memory management.

    82. Re:C++ long-in-the-tooth? by m50d · · Score: 2, Insightful

      No professional computer programmer should be incapable of programming without automatic garbage collection, just as no aeroplane pilot should be incapable of flying without an autopilot. You shouldn't be doing it very often, but you absolutely should have the ability.

      --
      I am trolling
    83. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      As for your comments about new and delete, using them correctly doesn't take a lot of in-depth knowledge. It's not that hard to remember that every time you create something, you must destroy it or you'll leak memory. If you can't figure those out, you should be sent back to school before being allowed to touch a single line of code.

      new and delete commonly snag even veteran programmers. One common error that is often only seen at runtime is returning a reference from some member function such as const Info& getinfo(void){return *info;}. This will break when you get into situations that use copy constructors. The failure here is not remembering how new and delete are called in the copy constructor.

      I wouldn't say that new and delete need books written on them, but they are hardly trivial. When you start overriding them or playing with inheritance then you need to know how they actually work.
    84. Re:C++ long-in-the-tooth? by plover · · Score: 3, Insightful

      Frankly if you can't look at a problem and then pull out five or six languages from your tool belt and evaluate which will be the best for this job, then you are a bad programmer.

      While I agree with this sentiment on principle, in practice this has proven to yield unworkable solutions. Different people bring different skillsets to the table. You may have a dozen developers who all have C++ in common, but to varying degrees. One may be more skilled in Perl, another in smalltalk, another in Python, and three more in Java. Divvy up the specs and tell each one to "Write your code using the best tool for the job." Then spend another year trying to integrate the pieces, and when they quit try to hire someone who can maintain the hydra.

      Picking a single language for a project (at least at the component level) is pretty much a requirement.

      Even though they try to hand-wave it away, this has been a big problem in the Microsoft .NET world. When it was introduced, Microsoft promised that all .NET languages were equal, first-class languages (my interpretation at the time was that C# programmers were instantly demoted to VB programmers :-( ) and that a developer could write in whichever .NET language they were most comfortable. But there are C# programmers and VB.NET programmers who don't really speak each other's language, even though they all compile down to the same MSIL. Trying to get them to maintain each others code leads to a lot of squabbling.

      It's easy to say "A good programmer can write in any of these languages" but in reality it's much harder to find a lot of good programmers that are both willing and able to competently do maintenance in all of the languages you might end up with.

      --
      John
    85. Re:C++ long-in-the-tooth? by zullnero · · Score: 1

      Read the post again. They're not replacing javascript with Flash, for heaven's sake. They're using an engine that is also used for flash, but that doesn't mean they're actually replacing javascript for flash.

      That's like if someone were to release a game that used the Valve engine, and someone else were to respond "Holy cow, you're making Half-Life!"

    86. Re:C++ long-in-the-tooth? by MenTaLguY · · Score: 1

      The other difficulty with smart pointers is that (used naively), they incur a write penalty from incrementing/decrementing the counter every time a pointer is copied. Used pervasively, they can be the death of a thousand cuts performance-wise, and are quite bad for multithreaded situations too.

      (On a different note, forgetting to clear an unused reference that pins an object in memory does indeed qualify a memory leak.)

      --

      DNA just wants to be free...
    87. Re:C++ long-in-the-tooth? by zullnero · · Score: 1

      Well, I should say officially, "The Source" engine instead of the Valve engine.

    88. Re:C++ long-in-the-tooth? by Mr+Z · · Score: 1

      You might check out the Boehm GC.

    89. Re:C++ long-in-the-tooth? by VGPowerlord · · Score: 1

      I can't speak about the rest of Java, but SWT, the GUI toolkit that Eclipse uses, requires you to manually dispose of GUI objects when you're done with them.

      Needless to say, this can cause leaks if you're used to Java freeing things up for you. Of course, it helps that SWT disposes of any child objects when you dispose of a parent object... or at least it's supposed to.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    90. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      The parent's post should be put in a FAQ somewhere.
      Just want to point out that the most common auto-destroying variant of malloc
      for allocating on the local stack is alloca, a BSD extension.

    91. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 1, Interesting

      ... proper memory management should simply fall into place on top of a clean architecture.

      And how, pray tell, does one "cleanly" deallocate cyclic, self-referential, dynamically-typed data structures, such as the ones that naturally arise with Javascript and HTML?

      With garbage collection, that's how. All possible solutions are isomorphic with garbage collection.

      So the real choice is between (1) the GC-nonexpert writes their own GC to cover a subset of the data structures when they should be writing their app, or (2) to use a modern, solid, pre-written GC for the whole app.

      I would also like to know how you plan to, using architecture alone, coalesce data to reduce memory fragmentation and return slack space to the system. Manually doing that to the heap is a nightmare verging on a total impossibility, whilst a good GC can do it automatically if you can afford the execution time. (And a really good GC could re-lay-out data w.r.t. cachelines to optimize performance on actual runtime data.)

    92. Re:C++ long-in-the-tooth? by owlstead · · Score: 1

      Yeah, the problem is that everyone thinks he/she is a skilled programmer, and all of them still make these stupid mistakes none-the-less. We did some testing with some tools that tested for memory leaks and found that all "experienced" C++ programmers made mistakes cleaning up objects or otherwise malloced memory. The number of CPU cycles needed for garbage collection is not that huge but good programmers brains are as scarce as they were 10 years ago. Lets use those brain cycles sparingly for low level jobs, and use them for something more constructive instead.

    93. Re:C++ long-in-the-tooth? by naasking · · Score: 1

      Actually, the big language culprits would be those with auto-garbage collection, etc. as they tend to have lazier programmers that don't "need" to manage their own resources, and in some cases even prohibit the programmer from being able to manage their resources.

      Given this comment, I'm pretty sure the only garbage collected language you've used is Java, or perhaps a community language like Python. I assure you that garbage collection is quite efficient in serious languages when compared to manual memory management (see OCaml) if you actually read the GC literature on effective algorithms and not simply assume reference counting or other naive GC scheme is clearly optimal; more importantly, automatic memory management is much safer since there are no leaks.

      Heck, even Mono's C# implementation uses half the memory of the Java VM, and Mono still uses conservative GC, not accurate GC! Memory efficient GC'd languages are possible, and profiling your application in such languages to isolate and optimize resource use is entirely possible, and in the end, you have no leaks due to the automatic memory management. You can't say the latter for any C/C++ software.

      C/C++ and similar languages, on the other hand, force the programmers to manage their resources.

      This what I call "The Grand Misconception". C/C++ does not "force" you to manage resources at all. In fact, the complete lack of this forcing is the result of most bugs with C/C++ programs: leaks, buffer overflows, etc. The C/C++ type systems are simply not powerful enough to reason about resource lifecycles, which means you are free to manage resources, or not, or manage them improperly, at your leisure; sounds great sometimes, and yet it leaves us with software like IE, Firefox, etc., which are generally funtional, but where leaks and security holes are prevalent and likely impossible to entirely eliminate. Any resource leak is an exploitable security hole, period (but not the only source of security holes).

      If a language did actually force you to manage resources, then it would produce compile-time errors when you misused a resource, ie. early deallocation, dangling pointers, etc. If you don't understand what that means, then I suggest you read up on more CS literature, specifically linear types, alias types, region types, and region-based memory management (as used in the Cyclone language). These are type systems where resources can be managed more explicitly, but which produce compile-time errors when a resource is misused in some way.

    94. Re:C++ long-in-the-tooth? by FnH · · Score: 1

      > (On a different note, forgetting to clear an unused reference that pins an object in memory does indeed qualify a memory leak.)

      I know ... I tried to make the subtle difference between memory that's forgotten, but could still be freed and memory that's irrevocably lost (no pointer to it anywhere in the program, but not freed) ... but yeah ... it's a memory leak as well.

    95. Re:C++ long-in-the-tooth? by ScrewMaster · · Score: 1

      Certainly, and while we're at it let's not forget the basics, such as knowing how to do long division by hand.

      --
      The higher the technology, the sharper that two-edged sword.
    96. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0
      Has anyone who's commenting here actually worked on a large scale C++ project?

      If you have great discipline and well defined design and interfaces, who, how and when memory is allocated and freed isn't that big a deal. Smart pointers work, new and delete work just fine, it's usually not that big a deal. However, if you do anything at all haphazardly, if you try to incorporate every single utility library under the sun, if you have an army of hackers all doing what they think is best to get their own tasks done, it's amazingly easy lose track. Good programmers, bad programmers, good design, bad design, it's no matter. I suspect that all it takes to start it off is just lazily adding a new library that does memory management just a little differently than everything else and then it's a cascade effect... Then, what happens is you try to do the right thing and clean up after yourself and freeing memory causes something to crash so you stop doing it.

      It's like the number one stability problem for C++ apps, developers lose track of who is responsible for the memory and you end up with double frees and leaks. So big a problem is it, that a number of larger C++ projects do crap like reference counting and what have you because the language doesn't support GC. Has nobody else noticed this pattern? Sure, it's always easy to manage memory if everybody is good but that's just not the case on large collaborative projects. Not just that but apps like Firefox/Mozilla depend on ton of lower level libraries written by others, what happens when libjpeg has a leak?

      Not to be all Paul Graham, but I think this is a language issue. I did a bunch of pascal in a different life and I can't remember ever spending that much time on a memory leak, the language just made it easy to pass data structures around and spelled it all out. I'm not suggesting using Ada or Pascal for something like Mozilla but it'd be an interesting experiment to see how reliable and good a Java version would be vs. the C++ version vs something else. It's so big as it is now, I can't imagine that the java version would be that much worse. At some point, a memory efficient version, regardless of the language will outperform a memory stupid version done in C or C++.

    97. Re:C++ long-in-the-tooth? by Nicolay77 · · Score: 1

      There's no way you can make me use Azureus over uTorrent, or a browser written in Java over Opera.

      --
      We are Turing O-Machines. The Oracle is out there.
    98. Re:C++ long-in-the-tooth? by siride · · Score: 1

      I hope by "readily feasible", you mean "hard, but not impossible". Obviously (and necessarily) anything that can be done in a higher-level language can be done in assembly.

    99. Re:C++ long-in-the-tooth? by HeroreV · · Score: 1

      You are fighting a losing battle. (Or perhaps I should say "loosing" battle?) People who are unable to modernize have dismissed assembly language, high-level languages (like C), OOP, etc as "hand-holding tools" that real programmers didn't need, but those things took over anyway.

      If you can't code in binary/hexadecimal, you belong in a different profession. But you also belong in a different profession if you willingly chose to code in binary/hexadecimal and refuse to use new technologies that would make you more efficient.

      If something will make you a more efficient programmer, it's a good thing! It's not something to be dismissed!

      That doesn't mean you should always use the latest and greatest. After all, assembly still has it's place. It just means you shouldn't think of new more efficient ways of programming as being only for poor programmers.

    100. Re:C++ long-in-the-tooth? by multipartmixed · · Score: 1

      Thank you!

      I almost take back most of my post. "Almost", because, while I'm technically correct, the cases which break the Boehm (and other C) garbage collectors really have no business in 99% of C code, and can certainly be designed around if garbage collection were chosen as a memory management technique at the outset.

      I actually read that page (or one like it) about 10 years ago. But I was too green back then to fully understand it, and so I promptly forgot about it.

      Interestingly enough, now I know where the Macromedia guys got their ideas for the Actionscript (cum Tamarin) garbage collector. It's really quite a lot like the Boehm collector and other tweaks described in some of the linked papers. They truly have stood on the shoulders of giants.

      I guess it goes to show -- no matter HOW MANY C tricks you know, there is always some guy out there the net with one that'll blow your socks off. Thanks!

      --

      Do daemons dream of electric sleep()?
    101. Re:C++ long-in-the-tooth? by chromatic · · Score: 1

      Of course. I'm sure you could implement memory pools in assembly language, but I'm not sure that the natural and idiomatic way to write assembly code lends itself to the best representation of certain algorithms and optimizations. (It is interesting to consider that both assembly and very high level languages, at least 3GLs, both support eval natively.)

    102. Re:C++ long-in-the-tooth? by David+Gould · · Score: 1

      Anyone can think about the "big picture" after spending a year or two at ITT Tech. *shudder*
      --
      David Gould
      main(i){putchar(340056100>>(i-1)*5&31|!!(i<6)<< 6)&&main(++i);}
    103. Re:C++ long-in-the-tooth? by antonyb · · Score: 1

      Nor anyone making sweeping generalities.

    104. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 1

      Given this comment, I'm pretty sure the only garbage collected language you've used is Java, or perhaps a community language like Python. I assure you that garbage collection is quite efficient in serious languages when compared to manual memory management (see OCaml [debian.org]) if you actually read the GC literature on effective algorithms and not simply assume reference counting or other naive GC scheme is clearly optimal; more importantly, automatic memory management is much safer since there are no leaks.

      Define a memory leak.

      To most, a memory leak is simply when a pointer to memory is lost. This is something GC can theoretically solve. But is that truely a memory leak?

      I propose that that is really the symptom of a memory leak, and that a memory leak is truly maintaining memory beyond when it is needed. This is something a GC cannot solve, as you may still have a valid pointer pointing to the memory still in scope even when the memory is no longer needed.

      How does this differ? Consider a single function that allocates some memory, makes use of it, and then goes on to do something else that doesn't require the memory; the pointer to the memory is in scope throughout the entire life of the function. According to the "normal" view of a memory leak, there would be no memory leak in this function unless the memory was not freed before the end of the function - or a GC would clean it up shortly after the function leaves scope. However, according to my proposed definition, even if you waited until the end of the function and then cleaned up all your memory, it would still be a memory leak as you kept the memory around longer than you needed.

      Now perhaps in a normal desktop environment the difference is not a big deal. However, it would be a big deal in an embedded or OS kernel environment, or any other environment where either performance or memory utilization needed to be maximized (e.g. a program that performed tasks that utilized gobs and gobs of memory and needed all the memory it could get).

      This what I call "The Grand Misconception". C/C++ does not "force" you to manage resources at all. In fact, the complete lack of this forcing is the result of most bugs with C/C++ programs: leaks, buffer overflows, etc.

      I wouldn't necessarily call it the "Grand Misconception". And if you read my other posts in this thread you would notice that my view does not adhere that as a misconception at all - rather, it takes that into account as being the mechanism by which the program is forced to do their resource management.

      Honestly, OS's have to manage their resources - file systems, memory, processor time, and all kinds of stuff - and in reality, every program is in effect a small operating system dedicated to a single task, the task of what the program is trying to achieve, that is built on top of other operating systems - e.g. standing on the shoulders of giants. Programs really do need to manage their resources, which in most cases is just memory and UI resources, and sometimes involves files and devices too; often some of this can be left to the host operating system, however, anything that causes the program to fail forces the programmer to fix it - thus memory management is required for any program. GC's allow a programmer to be lazy by not doing this; languages like C and C++ - Pascal, Ada, and many others even - force programmers to manage their memory or risk crashing due to memory leaks (" normal" definition memory leaks).

      Now may be you don't agree - that's fine. However, we should all strive to be better programmers, and learning how to manage our resources is one step along the way - a necessary step at that.

      which are generally funtional, but where leaks and security holes are prevalent and likely impossible to entirely eliminate.

      It is only impossible to entirely eliminate it if the lower levels do

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    105. Re:C++ long-in-the-tooth? by Tablizer · · Score: 1

      The point is that there is a general trend over time to use higher and higher memory abstraction, and C/C++ seems to be falling behind a bit. I don't know if Java's memory management is the ideal, but it is probably closer to what the future de-facto systems language(s) will be.

    106. Re:C++ long-in-the-tooth? by smellotron · · Score: 1

      ...most computers spend most of their time idle anyways, and most application are idle waiting for inputs...

      So in the once in a while heavy processing moment say in this case an HTML Render adding 1 second to the load in real life most people wont notice unless they are going back and forward button crazy

      Actually, it's fairly well accepted that making a computer "feel" responsive is far more important to desktop users than increasing its throughput. For example, Ubuntu's desktop and server distributions have different kernel parameters targetted respectively to improve UI latency and throughput. For specifics on the web, check out Jacob Nielsen's site (he lists further references for HCI studies). The quickest way to make an application feel unusably slow is to block the UI while processing, so it is crucial that UI interaction either be very fast, or delegate its work to another thread/process.

      It's perfectly fine to trade efficiency for simplicity, but UI latency is not the place to do that trade.

    107. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      Rewriting in C++ where we used smart pointers improved the performance 2-3x, mostly owing from the lack of GC and copious use of stack-based objects.

      FYI, if you still need to improve performance, look up Alexandrescu's article on small-object allocators. It sounds like you're frequently allocating/deallocating many objects, presumably small, and custom allocators can produce huge gains for this.

      - T

    108. Re:C++ long-in-the-tooth? by Anonymous Coward · · Score: 0

      Apparently you've never programmed in ActionScript 3. It's basically javascript, complete with OO capabilities.

      And the timeline? If we dump it in favor of raw code, we will live in a world aesthetically designed by programmers. I, for one, am not ready to get ready of artists.

    109. Re:C++ long-in-the-tooth? by suv4x4 · · Score: 1

      Tamarin will run javascript 2, which will to do javascript what the move from actionscript 2 to 3 did for flash/flex. In short: it will make non-toy applications easily done, instead of just marginally feasible. They plan to migrate the firefox UI and extensions to javascript 2, which should negate the performance issues.

      I'm aware of Tamarin but it won't help them, since interpretation speed isn't their bottleneck.

      Firefox responsiveness feels bad because the entire application is rolled up into a single thread, where the UI keeps stalling waiting for something not directly related to happen in the backend.

      Unless this is fixed, Firefox will keep stalling. It'll stall "faster" but it'll stall for the same time. I leave it to you if this helps much.

    110. Re:C++ long-in-the-tooth? by shutdown+-p+now · · Score: 1

      Just to add to this, in many cases, smart pointers don't just help, but are simply essential in well-behaved C++. If you have more than one new in a constructor without the results being assigned to smart pointers, you have a potential memory leak - if either throws, your destructor with deletes in it is not going to be called, since the object dit not finish constructing!

    111. Re:C++ long-in-the-tooth? by shutdown+-p+now · · Score: 1

      Because a routine can still be called that may access the object, so it can't be deallocated? A compiler has to err on the side of caution, but that's an err nonetheless.
      That's precisely what smart pointers are designed to solve. Either you have a single-owner semantics for your object, in which case consistently using auto_ptr (not just for variables, but for function arguments and return types as well) ensures that it is upheld, and that the object can be safely destroyed with its owner; or you have an object shared between several others, which is what shared_ptr is for, complemented by weak_ptr for cyclical structures.

      There's really very little excuse for writing plain delete anywhere in your C++ code these days. It almost certainly won't make things any faster, and is very likely to introduce subtle but real opportunities for memory leaks (see my other post detailing one particular issue with constructors, for example).

    112. Re:C++ long-in-the-tooth? by shutdown+-p+now · · Score: 1

      Given that the C++ committee is seriously considering garbage collection for inclusion in C++09, and Bjarne Stroustroup personally considers it one of the most important improvements, I'd say that people claiming that GC is not the "C++ way" are wrong.

    113. Re:C++ long-in-the-tooth? by shutdown+-p+now · · Score: 1

      It's not that they are more careful - but to write a successful large program in C or C++, you have to manage your resources. If you don't - then the OS will kill the process as you will SEG Fault/etc. So, unless you are only writing small programs - like for a typical high school or college level class project - you have to manage your memory. (Even then, you have to to some degree.)
      Sure; and how many C++ programmers actually know how to manage resources properly? It's certainly possible, but due to the relatively complex semantics of C++ RAII combined with exceptions, it's not easy to grasp.

      The problems might change a little bit, but the base problems are still there. Java programs end up as memory hogs because you can't manage your memory - it's left to the GC
      My experience is that it has more to do with the fact that there's no stack allocation in Java for anything but primitive types. End result is that every instance of class Point - a pair of two ints! - ends up on the heap, with all the overhead this entails for both size (additional data for the heap allocator machinery - should be on the order of 6-8 words), and speed (GC has to consider all those objects for collection). Garbage-collected environments which allow for stack allocation (e.g. .NET) fare much better.
    114. Re:C++ long-in-the-tooth? by shutdown+-p+now · · Score: 1

      Even though they try to hand-wave it away, this has been a big problem in the Microsoft .NET world. When it was introduced, Microsoft promised that all .NET languages were equal, first-class languages (my interpretation at the time was that C# programmers were instantly demoted to VB programmers :-( ) and that a developer could write in whichever .NET language they were most comfortable. But there are C# programmers and VB.NET programmers who don't really speak each other's language, even though they all compile down to the same MSIL. Trying to get them to maintain each others code leads to a lot of squabbling.
      I think you misunderstood what MS was claiming. They weren't saying that any developer could easily shift from C# to VB.Net and back (though that is true nonetheless - your average C# programmer only needs to learn the different syntax to understand and code VB, since semantics are almost the same, and API is identical; from personal experience, a single day is enough to move from C# to VB.Net). They promised that C# and VB.Net components can interoperate flawlessly, and that much is true - you can have one guy code an assembly in C#, then have another use that assembly from VB.Net, using and extending the classes the first one wrote. This extends to every first-class .NET language, though the price is severe restriction on language features to provide the lowest common denominator for interoperability.
    115. Re:C++ long-in-the-tooth? by AVee · · Score: 1

      "If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!"

      Sure. But if you fail to understand and use these tools were apropriate you belong in a different profession as well.

    116. Re:C++ long-in-the-tooth? by Logic+and+Reason · · Score: 1

      While I'm not especially a fan of garbage collection, it seems to me what you're ranting about is reference counting, not all garbage collection. Tracing garbage collectors, like Java's, have none of those problems.

    117. Re:C++ long-in-the-tooth? by naasking · · Score: 1

      I propose that that is really the symptom of a memory leak, and that a memory leak is truly maintaining memory beyond when it is needed. This is something a GC cannot solve, as you may still have a valid pointer pointing to the memory still in scope even when the memory is no longer needed.

      How does this differ? Consider a single function that allocates some memory, makes use of it, and then goes on to do something else that doesn't require the memory; the pointer to the memory is in scope throughout the entire life of the function.


      Let's define two terms to further clarify: automatic memory management (AMM) and manual memory management (MMM). Given a particular AMM, your statement might be true. However, it is not true for all AMM techniques. It is also not true of all MMM techniques, but this property depends on the cleverness of the end-programmer, instead of the compiler implementor. I think you'll agree that the compiler implementor is likely to be the better programmer.

      Honestly, OS's have to manage their resources - file systems, memory, processor time, and all kinds of stuff - and in reality, every program is in effect a small operating system dedicated to a single task, the task of what the program is trying to achieve, that is built on top of other operating systems - e.g. standing on the shoulders of giants.

      The set of all programs that are non-terminating (like an OS) is a subset of the set of all programs. So no, not every program is like an OS. It also does not follow that a program must manage every byte of memory, because OS's deal with resources at a coarser granularity (pages mostly).

      Programs really do need to manage their resources

      I do not contest the statement that resources must be properly accounted for in any system (as improper accounting is the source of many security vulnerabilities), but I do contest the statement that this accounting must be manual.

      GC's allow a programmer to be lazy by not doing this; languages like C and C++ - Pascal, Ada, and many others even - force programmers to manage their memory or risk crashing due to memory leaks (" normal" definition memory leaks).

      It's not a matter of laziness, it's a matter of hard design and error-prone usage. Introducing MMM has a ripple effect on an entire system, where its structure becomes exponentially more complicated in order to properly manage resources crossing interface boundaries. You can see this for yourself by contrasting the simplicity of libraries written in functional languages against those written in C/C++.

      It is only impossible to entirely eliminate it if the lower levels don't manage their memory properly either.

      This implies a stack-based memory hierarchy, in which case automatic region-inference could allocate and deallocate this memory for you even more efficiently than you yourself could. That's a solved problem. Problem is, resource lifecycles are often not stack-based; fortunately, newer region inference techniques are getting good at tackling these issues as well, and I predict that within 5 years we'll have an acceptable automatic region inference technique that will outperform MMM.

      however, my code managed its memory properly and that was the only memory issue in the entire program. If Microsoft did their job, then they would have managed their memory and the memory leak would not be there at all.

      Or, in order to close that 4 byte leak, MS would have had to alter the API in such a way that would force YOUR program to leak, or force you to contort your program and stand on your head in order to ensure leak-freedom. Fact is, we should leave the problems that are amenable to automation to the computers, and those that are not amenable to automation to the programmers. Memory management is an example of the former, and while there are currently domains where the automated solutions are not yet good enough, that gap is almost closed.

      I will grant you that security hol

    118. Re:C++ long-in-the-tooth? by Walles · · Score: 1
      managing resources can be hard - one project I worked on had to go through several months of testing to get the resources properly managed, and even then some of the resources were still a little uncontrollable

      In some cases using a garbage collecting language can be cheaper than several months of testing.

      --
      Installed the Bubblemon yet?
    119. Re:C++ long-in-the-tooth? by mcvos · · Score: 1

      If you're trying to shoehorn memory management back into something that didn't support it before, you're going to have issues- and this applies whether you're doing c/c++ style management, reference counting, or garbage collecting.

      But memory management should be transparent, and not interfere with your application code at all. And as far as I can see, that means garbage collection. Reference counting is leaky, explicitly allocating and deallocating infringes on application code.

    120. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 1

      The set of all programs that are non-terminating (like an OS) is a subset of the set of all programs. So no, not every program is like an OS. It also does not follow that a program must manage every byte of memory, because OS's deal with resources at a coarser granularity (pages mostly).

      Even the OS eventually terminates. I'd still put forth my paradigm works.

      Programs really do need to manage their resources

      I do not contest the statement that resources must be properly accounted for in any system (as improper accounting is the source of many security vulnerabilities), but I do contest the statement that this accounting must be manual.

      Accounting is a part of management. However, management goes further in that it assumes responsibility for allocating and de-allocating resources. Even if that is simply telling the GC that an item is no longer needed so the GC doesn't have to waste as much time with determining that the item can be freed for other uses.

      I still propose that no matter how complete the AMM may be, you still need a hybrid AMM/MMM such that the programmer can tell the AMM when something is no longer needed. The AMM may go further and help absolve conflicts between multi-threads, and such - and that is fine. However, the programmer still should have a way to tell it when it is done - perhaps as the programmer I want to release memory half way through a function instead of waiting for the pointer to go out of scope when the function exits.

      It is only impossible to entirely eliminate it if the lower levels don't manage their memory properly either.

      This implies a stack-based memory hierarchy, in which case automatic region-inference could allocate and deallocate this memory for you even more efficiently than you yourself could. That's a solved problem. Problem is, resource lifecycles are often not stack-based; fortunately, newer region inference techniques are getting good at tackling these issues as well, and I predict that within 5 years we'll have an acceptable automatic region inference technique that will outperform MMM.

      No, it doesn't imply a stack-based hierarchy - but a mix of stack and heap which is what most programming languages have. Heap allocations are really what needs to be tracked, and there should be a way for a free() function to determine if a pointer is pointing to something on the stack or the heap. Currently, this is not very doable.

      Then you would be wrong. We already know how to build secure software, such that the only attack vectors are social engineering. The problem is that people insist on using insecure languages, such as C/C++, which lead to easily exploitable vulnerabilities, such as buffer overflows. If you use a memory-safe language, you are already immune to buffer overflow attacks. If you then remove "access control lists" as the implicit access control and rely only on memory-safety, then you have now built a capability-secure platform, in which it is easy to reason about the causal effects of any given block of code, and thus, it is easy to design the program to follow the Principle Of Least Authority (POLA).

      We know how to write software that is only as secure as the attack vectors that we are aware of. Claiming otherwise is foolishness. We can mitigate how software is affected by unknown attack vectors through Defensive Programming methodology, but even that can only truly protect against known vectors.

      Additionally, reliance on a "memory-safe" language does not absolve you from buffer overflow attacks. Such reliance is foolishness - and is no better than security through obscurity. It also provides a fall sense of security. It may help to minimize such risk, but it does not absolve such risk - so please, stop fooling yourself.

      Finally, when properly employed - C and C++ can be just as well secured as

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    121. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 1

      In some cases using a garbage collecting language can be cheaper than several months of testing.
      Not really. It is far cheaper to resolve something during initial implementation than during testing; but it is cheaper to resolve it during testing than after it has been released to production or clients.

      There is no substitute for testing, and only dumb program managers cut themselves short on testing. And - FYI - GC makes debugging memory issues a lot harder as you have an inconsistently timed mechanism claiming memory from you. However good the GC may be - the timing differences it can cause can make a huge difference in being able to resolve something easily or not - in fact, whenever you have something that causes timing differences, the difficulty of debugging is magnitudes higher. So, even with a GC you will need to be doing months of testing.

      FYI - Open Source Software can get by with shorter testing periods because the testing is spread out among thousands of people. Where as a proprietary firm, like Microsoft - with notably takes a couple months to release a patch due to testing, cannot as they have to do their all of the testing themselves.

      Bad software gets out for several reasons - (1) developers don't do the engineering they should have, and (2) management crunches the schedule and doesn't let the developers do the engineering they should have or the testing that should have been done. Obviously, managers do need to manage the time line of a project, and projects need to get out. But you can't short change yourself either. I'd much rather a manager scale back a project to meet the time line than short change the engineering and testing; of course, you can't scale back too much either so this is really where the trade offs come and must be managed between the management and the developers. (Developers need to show the financial and business reasons to management for why to keep something, and should design/plan around being able to expand new features - or delayed features - in in order to help management make the deadlines. It's a two way street.)
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    122. Re:C++ long-in-the-tooth? by caerwyn · · Score: 1

      Nothing that goes on in a program is completely transparent, no matter how much people would like to claim it is. Garbage collection has its place. It also has its own set of faults and problems- and it's also not perfect, and it can be a crutch. You can, in a practical sense, leak memory just as easily in a garbage collected system as you can in any other.

      Explicit control, reference counting, garbage collection- the important thing with all of them is that you have to understand your memory management model and how it interacts with your application. If you don't, you'll have problems with all three. There is no panacea.

      --
      The ringing of the division bell has begun... -PF
    123. Re:C++ long-in-the-tooth? by naasking · · Score: 1

      Even the OS eventually terminates. I'd still put forth my paradigm works.

      An OS, as mathematical function, is a recursive, non-terminating program. It MAY terminate, but it need not.

      Accounting is a part of management. However, management goes further in that it assumes responsibility for allocating and de-allocating resources.

      Accounting is not done in any mainstream language in any usable manner. Regardless, I've been arguing the lifecycle of objects is better managed automatically than manually, and you have been arguing that, at least sometimes but likely often, lifecycle needs to be managed manually. The majority of security bugs found today would have been avoided if the software had been written in a memory-safe language, and many memory leaks would not exist given AMM. We can argue the performance tradeoffs of memory safety and AMM (empirical evidence suggest exec overheads around 15-20% and memory overheads around 50-100%), but that they both eliminate large classes of bugs, including security vulnerabilities, is an indisputable fact.

      However, the programmer still should have a way to tell it when it is done - perhaps as the programmer I want to release memory half way through a function instead of waiting for the pointer to go out of scope when the function exits.

      But why? If the region-inferencer (for example), determines that the lifecycle of a chunk of memory isn't used halfway through the function, then it will do it for you. If it's not smart enough, then you can refactor your function into two functions to ensure that regions are scoped differently. As a bonus, this results in a better design.

      Further, your approach can have a pathological effect on performance due to micromanagement. Why incur all the overhead of alloc/free'ing individual objects when you can alloc/free entire regions of objects at once. This is incredibly efficient, and further, leads to more efficient bump-pointer allocation techniques. Are you aware of the searching and fragmentation overhead induced by libc's malloc/free? This has been extensively studied.

      We know how to write software that is only as secure as the attack vectors that we are aware of. Claiming otherwise is foolishness.

      I can legitimately claim otherwise because software written to a POLA standard is maximally defensive, and so any remaining security holes are either
      a) an implementation bug which does not follow the specification, or
      b) inherent to the problem being solved and thus, fundamentally unsolvable without changing the problem specification.

      Stronger static types systems help reduce a) (and C/C++ have very weak type systems), and b) is essentially unsolvable without manual intervention.

      We can mitigate how software is affected by unknown attack vectors through Defensive Programming methodology, but even that can only truly protect against known vectors.

      Like most generalities, your statement is both true and false. It is false in the sense that a POLA design is already maximally defensive, and so the security properties can't be made any stronger without changing the entire specification.

      It's true because of the human factor in any system, and what you'll quickly find is that the majority of the security research by the capability security community are human-computer interaction attacks, ie. phishing, spoofing, etc. This is because automated attack vectors are no longer viable in POLA systems. I suggest you read the security audit of the DarpaBrowser built on the capability-secure language E for a taste.

      The "Defensive Programming Methodology" is actually a degenerate, specialized case of capability security.

      Additionally, reliance on a "memory-safe" language does not absolve you from buffer overflow attacks. Such reliance is foolishness - and is no better than security through obscur

    124. Re:C++ long-in-the-tooth? by Tablizer · · Score: 1

      Anyone who says differently has never had to manage any complex data structures that reference each other in non-trivial ways. The alternative is to basically write your own code that explicitly walks the data structure, deleting circular references, etc.

      Back in my Clipper days, I used indexed DBF files (tables) to store complex structures. They automatically cache to disk and were relatively fast. True, if you forget to delete the files when the program finished, it would take up disk space. However, it would just clean out any work tables upon the next start-up rather than add to them. Because most of the "model" was in cached tabels instead of RAM pointer structures, memory use was kept fairly small and predictable.

      I don't know if this approach would work well for building a browser, but for biz apps it worked well. And it may make multiple run-time instances tricky, but I found that multiple instances tended to confuse users anyhow.

      This approach is not for every application, but it provides an alternative way to deal with complex data structures. If tables allowed open-ended column sizes (which Clipper sort of supported but not efficiently), it in theory could be used to write browsers etc.

    125. Re:C++ long-in-the-tooth? by zapadoo · · Score: 1

      A skilled craftsman does not blame the tools.

      No, a skilled craftsman blames the project manager.

      (and then skips on off to the pub)

    126. Re:C++ long-in-the-tooth? by sjames · · Score: 1

      If the program is adequatly designed, memory management is NOT a big development time consumer. Most of it is a matter of making sure you create constructors and destructors together so they stay in sync. All pointers should be explicitly set to NULL when they're not in use. Furthermore, unless you do analysis PROVING that a pointer CANNOT have been used, it should be checked for non-NULL, freed, then set to NULL. If that causes a crash, someone screwed up but at least you tend to find the problem rather than silently leaking memory.

      If reference counting is in use at all, a debugging option should exist that overwrites all freed objects with poison just to make certain that some later access WILL be a crash bug.

      Personally,I think C++ is exactly in an ANTI-sweet spot. High enough level to sweep object management under the rug (with automatic constructors no less) and allow polymorphism through casting but not high enough to have built-in duck typing or an intrinsic class membership.

      By that, I mean if I set void *a to an object, I cannot simply delete a. Even worse, if a is a pointer to a base class and I delete a, I will delete the base class and silently leak any extra allocations done by the derived class's constructor. In Python (for example), where a=some object, if I delete a, it does the right thing no matter what sort of object a is. It's a mess.

      C++ was an interesting experiment that started as an advanced C preprocessor. That beginning explains a lot about it's limitations as an OO language.

    127. Re:C++ long-in-the-tooth? by Raenex · · Score: 1

      you have to understand your memory management model and how it interacts with your application. If you don't, you'll have problems with all three. There is no panacea. The thing is, you can write real, garbage collected applications and not once think about memory management, and have it "just work". That's a huge savings in brain cycles.

      Sure, that's not always the case, and when it does fail you have understand memory management. But it's a lot easier to focus on the failures than worrying about allocation all the time.
    128. Re:C++ long-in-the-tooth? by Paradox · · Score: 1

      The culprit is poor programming. If you can't code without hand-holding tools like automatic garbage collection, perhaps you belong in a different profession!


      If you can't separate your ego from your engineering, perhaps you belong in a different profession! Preferably one where I will never have to endure your masochistic BS.
      --
      Slashdot. It's Not For Common Sense
    129. Re:C++ long-in-the-tooth? by smallpaul · · Score: 1

      Yeah, I heard that garbage collection lead to the total failure of a few businesses that were otherwise likely to succeed: like Amazon, Facebook, Wikipedia and EBay. Google employs the inventor of Python and Apple added garbage collection to Objective C, so I guess those two companies are headed for the scrap heap as well. Is the usage pattern of these apps the same as Firefox's? No. But I just thought that your imagination needed a little bit of prodding since you couldn't conceive of an application in which multiple inheritance is an appropriate tool. According to you it shouldn't have been invented at all. By the way: used properly, multiple inheritance is also a nice tool!

    130. Re:C++ long-in-the-tooth? by Walles · · Score: 1
      In that case I mis-understood your statement. I interpreted what you said to mean that the "resource leaks" you were chasing for months were something that a garbage collector would have taken care of automatically. In which case the garbage collector would have been a drop-in replacement for those months, and most probably a lot cheaper.

      Considering how non-deterministic an ordinary system is anyway (due to swapping, system load, different CPUs characteristics etc) I don't really see how having a garbage collector would make thread races any harder to track down than before though. Do you have any actual real-life anecdotes or something to back this up?

      --
      Installed the Bubblemon yet?
    131. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 1

      Do you have any actual real-life anecdotes or something to back this up?
      I have had people tell me this and read about it in several places over the years. One that I found in via Google also gives some information - here, the key line is:

      It applies both to debugging issues in client code that manifest themselves as collector misbehavior, and to debugging the collector itself.
      Emphasis added. I would also point out that the garbage collector itself can cause race conditions to occur differently when you do run software as you have no control over when the GC runs - thereby, the very fact that you have a GC causes code to run differently every time you run, or even every time you go into a function as the GC may or may not have run recently wrt that code In this respect, even for a single threaded program, GCs add the complexity of a multi-threaded programming. That is simply the nature of a GC as you have no guarantee that it will run exactly the same time in exactly the same way between any two runs of the program. (E.g. the GC may run earlier in one instance than the other, thus offsetting every GC run after that even if all other runs occurred identically between the two instances.)
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    132. Re:C++ long-in-the-tooth? by rjstegbauer · · Score: 1

      I love GC, not because I don't have to manage the memory, but because I don't have to DEBUG memory overwrites.

      I can't tell you how many hours (days, weeks) I have spent debugging a multi-threaded program only to find I was off by one somewhere.

      THAT is where the savings is.

      Oh yeah, developers should first create a decent design with memory usage in mind.

      Sloppy developers will be sloppy in about all aspects of programming...not just memory usage, so one less thing for them to mess up is likely a good thing.

      Love to Code,
      Randy.

    133. Re:C++ long-in-the-tooth? by Walles · · Score: 1
      The article you're linking to refers to using a GC together with C / C++. I'm not advocating running GCs with C / C++ because I don't have any experience with that. For most purposes I don't advocate C / C++ at all because they enable people to over-write memory randomly and get problems that need months of expensive testing to track down :-p.

      I'm advocating using languages designed for garbage collection (and that prevents the user from dealing with pointers directly).

      As for timing issues, the GC will cause pauses at random times, but so will the OS' process scheduling and interrupt handling. Are you saying that GC incurred timing issues are somehow more problematic than OS incurred timing issues?

      --
      Installed the Bubblemon yet?
    134. Re:C++ long-in-the-tooth? by TemporalBeing · · Score: 1

      As for timing issues, the GC will cause pauses at random times, but so will the OS' process scheduling and interrupt handling. Are you saying that GC incurred timing issues are somehow more problematic than OS incurred timing issues?
      I'm not necessarily saying they are more problematic, just that they are another issue. I could see them being so, though only slightly so, as it is code you are providing with your system.

      Also, while the article may be referring to C/C++, it would certainly extend beyond simply C/C++.

      I've had this conversation before and had someone raise up that there are a number of issues - I thought it was on /., but I can't find it using Google. It might have been on a mailing list though. If I find it, I'll post it. I raised the timing issue because it is one I know of - and easily extrapolated.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    135. Re:C++ long-in-the-tooth? by ultranova · · Score: 1

      Indeed. That's why I love C++'s RAII.

      Try this:
      Crash.java

      Try this:

      #include <cstdio>
      using std:cout; int main() { int *i; { i = NULL; cout

      OMG it crashes ! C++ is shit ! I can make it crash when I purposefully create a program to do so !

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    136. Re:C++ long-in-the-tooth? by peterpi · · Score: 1

      But what I wrote is not purposefully breaking the system, it's just forgetting to release a resource. That was the point I was trying to give an example of. Java falsely claims that you don't have to worry about releasing resources any more because the garbage collector will get it in the end. That claim only holds for resources such as memory, that are so plentiful that you don't need to immediately return them to the system. The Java example I gave is clean, it compiles, the error would more than likely be missed by most peer reviews. Even if I had closed the inputstream just before it went out of scope, an exception (or a badly placed return or continue) would bring us out of the scope before the Close() function was called. RAII gaurantees that resources are cleaned up no matter how you exit the scope.

    137. Re:C++ long-in-the-tooth? by ultranova · · Score: 1

      Java falsely claims that you don't have to worry about releasing resources any more because the garbage collector will get it in the end. That claim only holds for resources such as memory, that are so plentiful that you don't need to immediately return them to the system.

      The reason the garbage collector works for memory is that the failure to allocate sufficient memory is what triggers garbage collector, rather than any abundance of memory.

      Even if I had closed the inputstream just before it went out of scope, an exception (or a badly placed return or continue) would bring us out of the scope before the Close() function was called.

      That particular problem can be solved easily with the try {} finally {} construct. FileInputStream file = null; try { file = new FileInputStream("crash.java "); } finally { if (file != null) file.close();}

      But yes, this is a problem. I'm not sure there is a clean solution for it, however.

      RAII gaurantees that resources are cleaned up no matter how you exit the scope.

      Well, the finally block will be executed no matter how the try block is exited, so such things can be arranged; however, it is a needless hassle to set up and certainly something a novice programmer - or even a senior one - could easily forget. I'm not sure there is a good solution, thought; even RAII is not applicable for every use (specifically, it can't be used for files which need to be kept open, like database files).

      A bandaid might be to trigger garbage collection when the system runs out of file descriptors (since garbage-collecting an object representing an open file causes the underlaying file to be closed in Java), but that is not a general solution.

      Of course, the ultimate reason for all of these troubles is that most current operating systems were written in C or C++, making them the "native" languages of the system. Writing the entire system from the kernel up with an object-oriented, type-safe, bounds-checked language would solve the whole problem. After all, a file descriptor is simply an integer, used as a token to identify an open file, which in turn is a kernel data structure; the number of open files is not inherently limited by anything but memory, so making the entire system a single garbage-collected entity would mean that any "open file" data structures no longer referenced by anyone would be cleaned up with the rest of the rubbish. After all, the only reason a file needs to be specifically closed in current systems is that the system has no way of otherwise knowing you won't be using it anymore (and because most runtime libraries, including C ones, buffer writes to files due to the high overhead of system calls).

      As an added benefit, given the above constraints on memory and resource access, there would be no need to run the user code in a separate processor ring as the kernel; in fact there would be no need to run anything in a separate virtual memory context. This could potentially mean a huge recuction in the cost of system calls, interprocess communication, and context switches. It would also make Hurd-like microkernel architechtures a lot more viable.

      C and Unix were born together, and the former still pretty much defines the latter (and all the imitators); maybe it is time to start building the next generation of operating systems, based on new object-oriented bounds-checked garbage-collected programming languages. Or perhaps even LispOS :).

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

  19. Fix the bloat and focus stealing by Anonymous Coward · · Score: 0

    What happened to the lightweight & responsive firefox (phoenix) as an alternative to pigzilla (mozilla)? Why and how have the bloat, memory leaking and focus stealing been allowed to get so bad? I still use Firefox 0.8 (zero point eight!) as my primary linux browser because the new versions blow chunks.

    Focus stealing in everything past 0.8 happens with Focus Follows Mouse and keyboard shortcuts.. You close a window with a keyboard shortcut only to have the wrong window close due to focus stealing. Or the rendering in a background firefox window slows or blocks the rendering of a foreground window.

    Even the crutch of a faster CPU can't fix these problems.

  20. A possible fix? by angryfirelord · · Score: 1

    I haven't tried it myself, but would this be a temporary cure? http://www.freerepublic.com/focus/f-bloggers/1327586/posts

    1. Re:A possible fix? by vidarh · · Score: 1

      No. Those of us suffering actual memory leaks have been through that and half a dozen other changes without seeing any difference.

    2. Re:A possible fix? by Anonymous Coward · · Score: 0

      Would you actually trust advice from someone who thinks computers count in base 12?

  21. the solution is simple by Ryzzen · · Score: 1, Interesting

    www.opera.com ;P

    1. Re:the solution is simple by Anonymous Coward · · Score: 0
    2. Re:the solution is simple by Trillan · · Score: 1

      Firefox's leaks can be fixed by restarting the browser. I appreciate that some people like Opera, but for me it's a no go. No matter how many times I restart Opera, I still find it unnecessarily ugly.

    3. Re:the solution is simple by mapsjanhere · · Score: 1

      NoScript add-on seems to do the trick too. Restored my old laptop from doorstop back to "browse while gaming" 3rd machine.

      --
      I'm aging rapidly, I bought a new game and had no idea if my machine was good for it.
    4. Re:the solution is simple by Kelson · · Score: 1

      No matter how many times I restart Opera, I still find it unnecessarily ugly.

      Well, you see, these days we have these things called themes or skins. If you don't like the way an app looks, you can often make it look like something else.

    5. Re:the solution is simple by Trillan · · Score: 1

      Skins are skin deep.

  22. Glad the issue is getting some priority, but .... by waterbear · · Score: 2, Interesting

    I completely agree. I only have 384MB on the machine from which I'm writing this. There isn't room on the mb for any more than that. I got totally tired of the system seizing up when I used to use Firefox. So I switched to Opera. That's not completely immune to seize-up/memory concumption problems either. So I'll keep an eye open for significant improvements to FF, and just possibly switch back if they fix the memory bugs.

    I hope they won't totally forget the folks using older-specification systems, but I have my worries about the FF debugging process: I looked at the blog that was referenced in the article header, and some of the comments sound ominous for quality. The way some of them read, makes it seem as if patches to force memory-release in various situations are just going to be grafted on top of the buggy code. That looks like a recipe for performance loss, compared with the result of fixing the problems at their root?

    -wb-

  23. An act of balance by SplatMan_DK · · Score: 4, Insightful

    I can certainly understand why people are tired of FF memory leaks. Being a FF user myself, with open browser windows and multiple tabs all through the day, I have seen what happens to FF after 4-5 hours of intense browsing. And don't even get me started on the PDF and Flash plugins!

    Some would argue that the problem is sloppy coding, or poor encapsulation (a typical OO programmers point of view). But please remember, that even though modern browsers are GUI apps, they are coded much like low-level server processes or protocol stacks. Low-level programming using languages like C and C++ gives you more control and better performance, but at the expense of nicer development features like garbage collection and encapsulation.

    Think about it. Would you accept a browser that rendered HTML flawlessly and with absolutely no memory leaks, but took more than a minute to render each page? I think not.

    It's an act of balance, and the problem is not _always_ "sloppy coding". It is the increasing complexity of these apps, combined with user demands which push the development towards low-level development languages. From a realistic point of view, any app. written in low-level C with as many lines of codes as FF, is bound to have bugs and leaks. (perhaps except code controlling nuclear reactors and NASA satellites, but then the price of each line of code is also somewhat different).

    We - the end users - are not without blame.

    - Jesper

    --
    My security clearance is so high I have to kill myself if I remember I have it...
    1. Re:An act of balance by colfer · · Score: 1

      Also, they are swapping the old "Mork" database format, for history and bookmarks, etc., for SQLLite. Performance still has some shaking out to do before Firefox 3 can be released.

    2. Re:An act of balance by Hatta · · Score: 1

      You know, I don't see the big deal. I've got less than a gig of ram. I frequently open more than 40 tabs in one firefox sitting. I run firefox for a week or more at a time before I restart it. When I do it's mostly just because I want to get rid of all those tabs that accumulate. (somehow there's no "close all tabs" function.)

      Now granted, I use adblock and noscript. The only scripts I allow are the ones I actually need. The only flash that gets played are .flv and I launch external applications (xpdf) instead of plugins whenever possible. Maybe my browser never sees the crappy websites that waste all that memory. But from where I sit it's just not a problem.

      --
      Give me Classic Slashdot or give me death!
    3. Re:An act of balance by TheRealMindChild · · Score: 1

      Do you even know what encapsulation means?

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    4. Re:An act of balance by BuR4N · · Score: 1

      To be fair, at least in Windows, people look at the wrong type of memory usage, they look at the Working set and scream when its 500 MB for an application. The working set is the total allocated memory during the applications life time (if it hasnt been trimed) that includes both in-use and freed memory that the OS (Windows) have let the process keep if it need memory again. Windows starts trimming the working set when its down to about 10 MB (different level on different versions of Windows) of free memory.

      Private bytes on the other hand, is a much more useful metric for determin how much memory is in use by the application.

      Working set is the figure showing by default in the Task manager.

      I dont say that firefox isnt leaking memory, but looking into a default configured task manager wont tell you much about that.

      --
      http://www.intellipool.se/ - Intellipool Network Monitor
    5. Re:An act of balance by SplatMan_DK · · Score: 1

      Sure I do. Why do you ask? I mean, sarcasm aside, and in all honesty: why do you ask? English is not my first language - did I write something too unclear?

      - Jesper

      --
      My security clearance is so high I have to kill myself if I remember I have it...
    6. Re:An act of balance by SplatMan_DK · · Score: 1

      You are right. Didn't think of that. So I just put in a few more columns in Task Manager.

      Looks like FF leaks handles as well... or at least some of the plugins do.

      - Jesper

      --
      My security clearance is so high I have to kill myself if I remember I have it...
    7. Re:An act of balance by fbartho · · Score: 1

      right click on a tab, and you should have a "Close Others" option. Granted that closes only 39 of the 40 tabs, but it's close to what you were looking for :D

      --
      Gravity Sucks
    8. Re:An act of balance by vidarh · · Score: 1
      So you're one of the lucky ones. This has been one of the problems in getting this problem recognized as such - a lot of people have kept insisting it's not a problem, because it hasn't affected them.

      And there IS a "close all tabs", at least on a per window basis: function: File, Close Window. If you mean "close all but one", just open a new window and close the old one.

    9. Re:An act of balance by Explo · · Score: 1

      You know, I don't see the big deal. I've got less than a gig of ram. I frequently open more than 40 tabs in one firefox sitting. I run firefox for a week or more at a time before I restart it. When I do it's mostly just because I want to get rid of all those tabs that accumulate. (somehow there's no "close all tabs" function.)


      I'm also one us us apparently lucky that aren't seeing much of memory leaking; my sessions rarely use more than a couple of hundred megs, despite a large number of tabs. What usually forces me to restart the browser is the awful browser-eating bug 263160, which many of my friends seem to never encounter, but for me it's more or less a weekly nuisace :(

      --
      Everyone who makes generalizations should be shot.
  24. Re:I thought this was OSS? by SplatMan_DK · · Score: 2, Informative

    How is it that an open source project is taking this long to fix bugs such as this? Because knowing the symptoms is not the same as knowing how to fix the problem?

    Observing the existence of a memory leak, and knowing where to fix it in your code, are two VERY different things.

    - Jesper
    --
    My security clearance is so high I have to kill myself if I remember I have it...
  25. Reality check by MMC+Monster · · Score: 3, Insightful

    I can't imagine why anyone would tolerate such things.
    5 years ago people people would constantly belittle IE users because it had frequent crashes, and pointed to the 'superior' Mozilla suite. Today, FF has morphed in to something which can't be used, with plugins, for more than a couple days max without needing to be reset. Reality check: Most general users do not leave their browsers open for a couple days. Let alone a couple days max. In fact, I wager that most turn their computers off at the end of the day.

    No I don't have a source for my statement. But ask people you know who are not in the tech industry. The one outlier group is Mac users, who don't realize that closing a browser window doesn't take the program out of memory.
    --
    Help! I'm a slashdot refugee.
    1. Re:Reality check by sholden · · Score: 1

      How about everyone who justs flips the screen closed on their laptop when they're done with it?

    2. Re:Reality check by duplicate-nickname · · Score: 1

      With improved suspend states and hibernation, my PC and laptops are never shut off any more. I'm sure my browsers are left open for days or weeks at a time...but hey, I use IE and don't have to restart it every day.

      --

      ÕÕ

    3. Re:Reality check by dextromulous · · Score: 1

      I'm sure my browsers are left open for days or weeks at a time...but hey, I use IE and don't have to restart it every day.
      Indeed, I usually have my firefox window open 100% of the time opening and closing hundreds of tabs over the weeks until there is an update. Why close the browser when you can just hit "suspend" or "hibernate"?
      --
      There are two types of people in the world: those who divide people into two types and those who don't.
    4. Re:Reality check by smellsofbikes · · Score: 1

      I'm in the tech industry. I have a firewall/nat box, a 386, that stays on 24/7, but aside from that, all the other computers in the house get shut down every night, and rarely get turned back on until we come home from work. My brother's a Win admin at work, and his systems are all shut down every time he leaves the house for more than an hour, except for his MythTV box. Ditto my cousin, who does CAM stuff: everything goes off when she leaves the house. Combination of cost of power and too many power fluctuations/surges damaging computers. My mom, grandmother, and my girlfriend's family don't turn their computers *on* more than once every two days, and then only for an hour or so. That general usage pattern seems typical of the large majority of people I know.

      --
      Nostalgia's not what it used to be.
    5. Re:Reality check by TheNetAvenger · · Score: 1

      Reality check: Most general users do not leave their browsers open for a couple days. Let alone a couple days max. In fact, I wager that most turn their computers off at the end of the day.


      This is not the case anymore. Many users have a browser open all the time, using the 'multi-application' interface modern OSes allow easily.

      Also with enhanced Sleep(S4),Standby(S3), and Hibernation there are 'average/novice' users that simply never reboot their machines until a restart required patch is issued.

      A simple example, one client bought a new Vista laptop in July, they never closed IE7 nor restarted the computer until a Vista update two weeks ago wanted a restart.

      The reason I know they were not lying is that they forgot the login password they used when they setup the machine, and it has been in Sleep or Hibernation, and never restarted since July when they first setup the computer.

      Restarting computers is a thing of the past and something that is now only happening for updates or driver updates that require a restart.

      There is no reason a user needs to restart on a modern OS, closing the lid or hitting hibernate is far easier for notebook users and the 'norm'.

      We have clients that leave Word and Outlook and IE open 24/7 for weeks/months on end. If any of these applications had the memory issues Firefox has you would have seen 'numerous' articles on the internet with business people screaming.

      I agree with your assertion about Mac users with the ambigious close/exit concepts that are lost in the 1980s Mac UI usability concepts, and you are correct a lot of Mac users don't know the differnce between closing the active Window and closing the application. However, this isn't something they should have to think about.

      Sadly if MS can stablize IE with IE7 to be a low footprint memory application (that doesn't share any memory or DLLs with Explorer) then the bar is raised for Firefox and competitors to finally start addressing their 'issues' with performance and security. IE7 has been pretty tight regarding security and uses less RAM than Firefox, and peformance and CSS compliance is competitive if not better in some aspects as well.

      If firefox doesn't get some of these problems under control, there is no reason users won't start using IE again on Windows, and Firefox marketshare will start dropping. Right now the only thing keeping firefox from fast falling is the myths regarding IE that were true of IE4-6, but are no longer applicable to IE7. Also on Vista IE7 gets additional security by running with less than standard user security credentials.

      I hope people finally start admitting the problems that do exist with FireFox, if not the FUD of IE will not be enough to keep it gaining support on the Windows platform.

    6. Re:Reality check by Phroggy · · Score: 1

      How about everyone who justs flips the screen closed on their laptop when they're done with it? Mac users always do this, but PC users usually don't, because either the software or the hardware isn't reliable enough to make it work properly, so they've learned not to. Either it fails to go to sleep and overheats, or it fails to wake up and you have to reboot it anyway (losing anything you had open). If it works perfectly only 90% of the time, most people aren't going to chance it.
      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    7. Re:Reality check by earlymon · · Score: 1

      I know of few people who shut off their machines regularly (and none daily) - power cycling is a bad thing for long term semiconductor reliability. I'm surprised you even know people who don't know that. Sleep/wake cycle is better - and more productive - for daily startup (flash on instead of reboot) and closeup.

      Our mileage must vary - my general users are not your general users.

      --
      Pathological kinda promises Path + Logical - but instead, you get stuck with pathetic.
    8. Re:Reality check by Mr+Z · · Score: 1

      I know I am not "most users."

      $ ps guxww | grep firefox-bin | grep -v grep
      im14u2c 27191 6.3 13.0 991708 528428 ? Sl Sep09 1381:29 /usr/lib/firefox/firefox-bin
      $ uptime
      19:03:15 up 86 days, 59 min, 11 users, load average: 0.08, 0.06, 0.01

      But, then, I have the RAM for it. I just restart Firefox when it crashes. *shrug* Hell, GAIM needs to go on a diet:

      $ ps guxww | grep gaim | grep -v grep
      im14u2c 24132 0.0 1.1 650712 46492 ? Sl Sep09 1:01 gaim

      650MB for a chat client? Makes Firefox look positively svelt!

      --Joe

    9. Re:Reality check by Anonymous Coward · · Score: 0

      Umm.. have you actually ever held a desk job? People don't turn off their computers and will leave the browser open for weeks at a time. Just because your Mom doesn't, at home, doesn't mean that she doesn't at work. Us grown-ups don't restart our computer every few hours to reclaim memory between games - we work and leave our stuff open since we use it all the freakin time.

    10. Re:Reality check by makapuf · · Score: 1

      Reality check: Most general users do not leave their browsers open for a couple days. Let alone a couple days max. In fact, I wager that most turn their computers off at the end of the day. Sure, and for them WinMe should quite adequate ; a quick reboot from time to time isn't such a big problem.
  26. Time-based cache by Spy+der+Mann · · Score: 1

    One of the things they're adding is a time-based cache for unused images. For example, if after 5 seconds an image isn't used, it's freed from memory. This alone gave them a huge memory boost, IIRC.

    1. Re:Time-based cache by Ungrounded+Lightning · · Score: 0

      One of the things they're adding is a time-based cache for unused images. For example, if after 5 seconds an image isn't used, it's freed from memory. This alone gave them a huge memory boost, IIRC.

      Can you imagine how that will work with "forward", "back", and tabbed browsing on a slow dialup line? B-b

      When I'm out in the sticks and have just spent several minutes loading an image I don't want to do it all over again just because I flipped to something else for a few seconds.

      It drives me nuts - even when I'm on a fast DSL or T-carrier line - when web designers build in lots of graphics to prettify their pages without considering the download time for somebody who's not on the same machine or LAN with the server containing the files. So now the BROWSER developers want to "Speed up my browsing experience by freeing memory"? Yeah, right.

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    2. Re:Time-based cache by vidarh · · Score: 1

      What I don't get is why, outside of the caches (which have configurable limits), they don't use an arena based allocator on a per tab basis, with some separate arenas for shared stuff, like plugins and UI. Doing that would both make leak detection a lot easier (see which arenas keep growing over time), and would make leaks tolerable (close the offending tab, and the whole arena gets thrown out - problem solved). It's an OLD method, and it works well as a last resort safeguard against leaks.

    3. Re:Time-based cache by jesser · · Score: 1

      Gecko does use per-document arenas (class FrameArena) for allocating short-lived, document-specific objects. "Frames" (rendering objects) and several other types of objects are allocated from this arena.

      Many other objects associated with a document, such as DOM nodes, can be referenced from other documents, so they have to be subject to some sort of garbage collection.

      --
      The shareholder is always right.
    4. Re:Time-based cache by jesser · · Score: 1

      The new time-based cache will only be for the decompressed version of the image (where each pixel is represented by 3 or 4 bytes). The compressed version of the image will be treated the same way it always has been; Firefox won't need to grab it from the site again. At worst, it will just need to decompress the JPG/PNG again.

      --
      The shareholder is always right.
  27. X != Y Posts Considered Harmful by Anonymous Coward · · Score: 0

    There, two clichés in one post. I'm so sick of these...

  28. Re:You're already tolerating it by using it at all by Anonymous Coward · · Score: 0

    "I still read comments from people who claim they never have leaks with FF (we'll see some on this thread no doubt)."

    Here's one. I have 14 extensions running, haven't restarted firefox since yesterday, and have opened and closed a couple hundred tabs. Of course, I usually close firefox at least once a day, which it seems many people here do not. Still, Firefox is using 72 MB of memory, on a 2 GB system. After restarting, 67 MB. This is with 8 tabs open, 3 of which are mildly image intensive. What horrible leaks! But seriously, I've never seen firefox go over 100 MB or so no matter how much I abused it.

    Excellent point about the problem with managing features in extensions, though... it might be nice if some features that got cut off and stuck in extensions were cleaned up every few versions and certified or even offered as optional check-boxes during new installs.

  29. Firefox/Mozilla and Flash by Anonymous Coward · · Score: 0

    My biggest problem now is the fact that Firefox/Mozilla usually hangs when I watch Flash videos (e.g., youtube videos) on my ubuntu box. I don't think this has to do with memory leaks though. I have searched around the net for an way to fix the problem but I have not found anything. It seems to be affecting a lot of users though.

  30. FireFox == Internet by Frosty+Piss · · Score: 2, Interesting

    Nobody forces you to use Firefox. You can use Opera, Konqueror, links or IE, or any other browser out there...

    Maybe not, but in the Windows World, Opera is not a viable alternative to many people who find the Opera UI to be excessively daunting for casual use.

    The thing that has irritated me about this is that for a very long time, the FireFox leadership has insisted that there where no memory issues, that it was a specific type of use profile, and that if you knew the secrets of how to tweek the configuration file, performance would improve. This is the lamest of excuses.

    FireFox is not sold as some kind of "leet" hacker browser, it's sold as a browser for the people. FireFox leadership needs to be more responsive to the feedback from "AVERAGE" users if they want FireFox to be a major player in the browser world. 10% is nice, but it's still only 10%.

    --
    If you want news from today, you have to come back tomorrow.
    1. Re:FireFox == Internet by babyrat · · Score: 1

      FireFox is not sold as some kind of "leet" hacker browser, it's sold as a browser for the people.

      The last I heard it wasn't sold at all, but rather given away freely...

    2. Re:FireFox == Internet by Anonymous Coward · · Score: 0

      The last I heard it wasn't sold at all, but rather given away freely...
      Come on, pull your head out of your ass. Sold == Promoted. Get a clue about reading things in context.
  31. Why tolerate? by nerdacus · · Score: 1

    Frequent restarts of things on my computer make me furious. I can't imagine why anyone would tolerate such things.

    Because other browsers have their problems too, and I have to web browse with something.

  32. Because YOU allow it! by www.sorehands.com · · Score: 3, Informative

    It is because people accept poor programming as the norm. Oh, yeah, just reboot it and it'll be fine.

    I consult for someone who uses ACT! 2005. When they got the upgrade notice, they asked me to check it out. I spoke to ACT! support and they told me "We improved performance by releasing resources that we are no longer using." I said, "THAT IS A BUG FIX!" Anybody writing code outside of school should be doing it, and if I was grading their code, I would take points off for that.

    I'd like to see some of these software companies that do this get sued for such poor coding practices.

    1. Re:Because YOU allow it! by BalanceOfJudgement · · Score: 1

      I'd like to see some of these software companies that do this get sued for such poor coding practices.


      So would I, because it would stop this never-ending process of "faster, cheaper" that permeates software development. Nobody wants to spend time on architecture and debugging, they want to get it written as quickly and cheaply as possible to get it out the door.

      There's no negative reinforcement for that behavior because so long as they include the standard "this application is not guaranteed to do anything useful" disclaimer, no court will ever find them liable for the damage their system causes - like, oh, say, causing a power grid to shut down for 6 hours.
      --

      We are the fire that lights our world.. and we are the fire that consumes it.
    2. Re:Because YOU allow it! by Anonymous Coward · · Score: 0

      I'd like to see some of these software companies that do this get sued for such poor coding practices. Typical American response to everything.
    3. Re:Because YOU allow it! by Shotgun · · Score: 1

      But think about why they might be reluctant to release the resources. If you spend time releasing and reaquiring resources, you will be a good OS citizen, but you might not seem as fast as the other OS citizens that are hording resources to themselves. Lot's of programs in the "cooperative multitasking" days would grab the CPU and keep a death grip on it so that they could appear to be faster than the competition.

      --
      Aah, change is good. -- Rafiki
      Yeah, but it ain't easy. -- Simba
    4. Re:Because YOU allow it! by griffinme · · Score: 1

      (twitch twitch) ACT!2005, bane of my existence. We have gotten to the point of telling users they should just shut down the program every hour or so and perhaps think about doing a reboot while they are at it. One user asked me to look at her computer because it was running so slow. Out of 2gig of memory on her system, ACT! was using 1.5gig. I hate that program. Piece of . ... (twitches and mumbles more)

      --
      Is he strong? Listen bud, He's got radioactive blood.
    5. Re:Because YOU allow it! by Biffer4810 · · Score: 1

      I'd like to see some of these software companies that do this get sued for such poor coding practices.


      Oh? I hope you posted that because it's the first method of revenge that came to mind. Can you imagine what that would really mean? I'd be at the front of the people ranting when that article hit slashdot.

      We're not talking about the "fire missile" function on a jet-fighter, we're talking about a free(...) and dealloc(...). Do you want to see every Auto maker sued if they don't squeeze EVERY FRACTION of an mile out of a gallon of gasoline? SUED?
      --
      -.-- -.-- --..
      One fish / Two fish / Red fish / Blue fish
      ShyaOS - Think Differently!
    6. Re:Because YOU allow it! by www.sorehands.com · · Score: 1

      Oh? I hope you posted that because it's the first method of revenge that came to mind. Can you imagine what that would really mean? I'd be at the front of the people ranting when that article hit slashdot.


      We're not talking about the "fire missile" function on a jet-fighter, we're talking about a free(...) and dealloc(...). Do you want to see every Auto maker sued if they don't squeeze EVERY FRACTION of an mile out of a gallon of gasoline? SUED?


      How many automakers say, "we don't warranty that your vehicle will do anything?"

      This is the type of attitude that is a problem. Lets make your analogy a little more accurate. Every time you press the brake pedal, the return spring does not work properly causing the car's brake pad rubs the disk a little more so that after a few days, your brake is always sticking -- or until you pull the wheel off and manually pull it back.
    7. Re:Because YOU allow it! by www.sorehands.com · · Score: 1

      Typical American response to everything.
      I'd rather flogging of the CEO or president of the company, but the American legal system does not permit it.
    8. Re:Because YOU allow it! by sjames · · Score: 1

      Since most apps that hog resources have no valid reason, perhaps a built in delay that grows proportionally to the resources already allocated. For the few cases where it is actually justifiable, have a tuning parameter "allow_rapacious_resource_hogging". No venor is going to want to telkl the user to enable that unless they have a REALLY strong justification! :-)

    9. Re:Because YOU allow it! by ultranova · · Score: 1

      Since most apps that hog resources have no valid reason, perhaps a built in delay that grows proportionally to the resources already allocated.

      So they'll just set up a loader to start with the OS and hoard the resources so they are ready if the program is ever loaded.

      For the few cases where it is actually justifiable, have a tuning parameter "allow_rapacious_resource_hogging". No venor is going to want to telkl the user to enable that unless they have a REALLY strong justification! :-)

      They won't. They'll simply tell the user that the program needs to be run as root.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

  33. Might as Well Fix Javascript Too by joe_n_bloe · · Score: 1

    I'm sure it's part of the problem. I wish Firefox's JS implementation were as fast as Opera's, or even IE's. Its GC makes it jerky as all hell. Like, just now, as I type into this dialog box.

    1. Re:Might as Well Fix Javascript Too by BZ · · Score: 1

      It's being worked on. See http://www.mozilla.org/projects/tamarin/

    2. Re:Might as Well Fix Javascript Too by jesser · · Score: 1

      I've never noticed delays from GC, but dbaron (who keeps 400 tabs open) says GCs take a few seconds for him. How many tabs do you have open?

      --
      The shareholder is always right.
  34. Time To Chill by LifesABeach · · Score: 0

    After reading the threads, and noting the reactions, one has to consider the "Source". The difference between Close Sores, and Open Sores is that when you feel compelled to squawk, you can do something about it with Open Sores; But with Closed Sours You cannot. Try it with Microsoft, ask them to add the puny coding it would take to bring Internet Exploder up to CSS 2.0, or XSLT to 2.0, how about SVG 2.0 handling? But with an Open Sores solution, if you do not like it, you can change it, NOW! Maybe the submitter of the Parent Article could tackle the Memory Leaks of FF?

    "Do you want some cheese with that wine?" - Unknown

    1. Re:Time To Chill by Anonymous Coward · · Score: 0

      Spoken like someone who's never coded in their life. Add "puny coding it would take to bring Internet Exploder up to CSS 2.0"? Uhm... with out knowing IE's code base, I can tell you that wouldn't be "puny coding". The submitter should tackle the leaks? Uhm... the coders familiar with this extremely large code base don't know how to fix the problem and you expect an outsider can jump in and fix it?

    2. Re:Time To Chill by prollifik · · Score: 1

      I had a look at the FF code and I got the impression that it would be a full-time hobby.

    3. Re:Time To Chill by LifesABeach · · Score: 1

      I think Carl Sagon said it best, "Take Baby Steps." At first look, FF code looks like a challange. But after awhile, one can begin to see the inner workings, and then begin to understand. I do not believe that anyone that worked on FF will be invited to go to Stockholm to collect a prize. And when one reads the personal comments of minor contributions to FF, one begins to get the concept that there just might be a solution that an "Average Joe" can submit. I applaud all the people who have made open source solutions.

      "We Can Be Heros" - David Bowie

  35. Mod parent up by Anonymous Coward · · Score: 5, Insightful
    The parent post is completely correct. The main problem with Firefox and Mozilla in general is the XUL architecture. It is single-threaded such that JavaScript cannot run in multiple threads. And I've tried. It can't be done, Firefox will actually crash. (You can try with XPCOM, but it will crash.) I asked, and the solution given to me by the Firefox community (which isn't necessarily the developers, mind you) was to use Java from JavaScript, which is a non-starter if you want to write a cross-platform extension. (Not because Java isn't crossplatform, but because you can't guarantee that Firefox will be installed with a JVM.)

    Firefox's problem is architectural and not one of garbage collection. Unfortunately part of their problem is garbage collection - it's due to their architecture, but they have at least four separate memory allocation schemes going:

    1. Custom malloc/free implementation. (Yes, custom - not from libc.)
    2. C++ new/delete operators, which for all I know may be overridden to use their malloc/free.
    3. One of the first two with reference counting to decide when to free/delete.
    4. JavaScript mark-and-sweep GC.

    Dealing with this causes some truly insane hacks, like the absolutely insane DOM C++/JavaScript implementation. (They're C++ objects, exposed as JavaScript objects, using something that's like XPCOM but isn't due to the overhead XPCOM imposes. I really don't understand it.)

    Ultimately, though, it's worse than all that. All this crap leaves the code completely opaque, and actively prevents contributors from contributing code without having to learn an insane amount of infrastructure decisions.

    It makes a project that's supposed to be open source effectively closed off to only the "official" developers: almost open source in name only.
    1. Re:Mod parent up by Anonymous Coward · · Score: 0, Flamebait

      > Custom malloc/free implementation. (Yes, custom - not from libc.)

      The "libc" malloc implementation for a certain platform is junk.

      > C++ new/delete operators, which for all I know may be overridden to use their malloc/free.

      Oh noes. It's especially fun that you don't even bother investigating the matter before attributing blame.

      > One of the first two with reference counting to decide when to free/delete.

      Which does waste a trivial amount of memory compared to garbage collection, but this is the least of the problems. The bookkeeping expense of reference counting is less than the problem of retaining references to objects erroneously.

      You're retarded. The major problems with Firefox are:

      1. It's over-architected with needless abstraction. This is also why everything that uses Mozilla as a basis is a memory hog.
      2. By default it's willing to cache a lot, long after tabs are closed and forgotten about.
      3. It can be difficult for the system to return pages because of fragmentation that results from not using a compacting garbage collector.

    2. Re:Mod parent up by Dr.+Spork · · Score: 1

      Thank you for this informative post. I wouldn't be able to understand Mozilla code even if I treid, but as a frequent user of Firefox, I already suspected something like this must be going on in the background. So here's a question: How much of this trouble is "inside" Gecko and how much is "outside"? Isn't all the XUL stuff just for the interface? Does Galeon, Epiphany, Camino and every other Gecko-based browser have similar problems? And if not, wouldn't it be worth it to aim at a Firefox 4.0 without XUL?

    3. Re:Mod parent up by BZ · · Score: 5, Interesting

      > 1. Custom malloc/free implementation. (Yes, custom - not from libc.)

      Uh... No. There are some arena allocators in use in the codebase for very specific tasks, but there is no custom malloc/free.

      > They're C++ objects, exposed as JavaScript objects, using something that's like XPCOM but isn't

      Actually, to be exposed to JS in Gecko something more or less has to be an XPCOM object at the moment. Then the XPConnect layer handles the glue between JS and C++.

      > It makes a project that's supposed to be open source effectively closed off to only the
      > "official" developers

      As someone who got into this project without being in any way "official", I beg to differ! ;)

    4. Re:Mod parent up by jp10558 · · Score: 1

      I think if they get rid of XUL, there goes all the extensions, and possibly makes extensions impossible, or at least needing to learn an entirely different and likely harder API.

      I'm not sure if Firefox could get away with killing all the current extensions requireing a rewrite.

      --
      Opera, Proxomitron-Grypen,GPG 0x0A1C6EE3
    5. Re:Mod parent up by sjames · · Score: 1

      I asked, and the solution given to me by the Firefox community (which isn't necessarily the developers, mind you) was to use Java from JavaScript, which is a non-starter if you want to write a cross-platform extension.

      When Java is suggested to IMPROVE performance, it must be bad!

      It's like suggesting hydrogen-cyanide as a treatment for lead poisoning!

  36. Where are the leaks? by PPH · · Score: 1
    On which platform? In the browser itself or dynamic libraries or drivers it uses?

    Cautiously avoiding the mention of anyones favorite O/S so as not to earn troll mod points; It all depends on where the leaks are. The only way to fix some of them would be to build a staticly linked executable. That still doesn't get you around kernel/driver bugs. In my experience, many apps that appear to leak quite badly on one system do very well on another.

    Hint: Try setting "LEAKS=OFF" in the registry. ;-)

    --
    Have gnu, will travel.
  37. More prevelant on Mac? by wizman · · Score: 2, Interesting

    I use Firefox on Mac (intel) and Windows, with the latest versions on both. I can have Firefox open for a full week on Windows without any problems, however on either Mac I have to restart Firefox about once every day or two, otherwise browsing slows to a crawl. At extremes the whole machine will start to bog down until I "force quit" (kill -9) Firefox. I'll also experience oddness where images will just stop loading.

    Running "bare bones" on all Firefox installs, no plugins other than whatever may have been included with the base distribution.

    Does anyone else notice this? I've switched back to Safari on the Mac in the meantime.

    1. Re:More prevelant on Mac? by Anonymous Coward · · Score: 0

      camino

    2. Re:More prevelant on Mac? by Danathar · · Score: 1

      The Mac version is problematic. Both for Intel and PPC. Crashing and big time CPU hog has been a problem for some time now.

    3. Re:More prevelant on Mac? by BenoitRen · · Score: 1

      Are you running a server room, or something? It would certainly help if you shut down your computer each day.

    4. Re:More prevelant on Mac? by theurge14 · · Score: 1

      Sometimes it does, but no more than it does on Windows at work.

      I like Safari alot, but for some reason I cannot use it to login to my Linksys router. Blame Linksys I guess.

  38. Re:You're already tolerating it by using it at all by Anonymous Coward · · Score: 0

    Interesting. I run Firefox with a few plugins. I leave it up all the time and have very seldom had a problem that wasn't related to a specific plugin - usually weather. I tolerate it because it is seldom. And since last update - not at all. As far as footprint 2,152K - hmm not too big... Especially with Explorer sitting at 6,524 K.

    I am not a fan boy but really. Did you ever think the problem is not the software base but a plugin or indeed, the way you are using it or even something else on your machine?

    As for bloat, bad coding is bad coding. Language is not the cause of bad coding. In C++, lazy can get you real problems quicker than other languages such as Java. However, all of them can get you into memory problems.

  39. Ah, The Joy of C/C++ by curmudgeon99 · · Score: 1

    Well, seems like this is time to extol the joys of the C and C++ language, with their delightful scavenger hunt the whole team can play: Find the Memory Leaks! Seriously--can you imagine a more embarrassing thing for the developers of Firefox? You guys were so sloppy that we're expanding the hunt for your mistakes to a world-wide level. Gosh, they must be proud of their work.

    1. Re:Ah, The Joy of C/C++ by slack_prad · · Score: 1
      From your signature I understand you are a java preacher.
      I say: Let's rewrite Firefox using Java!! After it's done, firefox would get a startup screen :O

      "Please wait. Firefox is now starting up...
      Initializing Java Virtual Machine"

      *shudders*
      --
      Sent from my desktop computer
    2. Re:Ah, The Joy of C/C++ by curmudgeon99 · · Score: 1

      I said no such thing. I am merely commenting on the obvious limitations of the C and C++ languages. If you are a C/C++ programmer I hope you notice the dwindling number of jobs. Do you think those people who have chosen to focus on Java are misguided?

    3. Re:Ah, The Joy of C/C++ by Anonymous Coward · · Score: 0

      If you are a C/C++ programmer I hope you notice the dwindling number of jobs.

      Your trollfu is weak.

      Do you think those people who have chosen to focus on Java are misguided?

      What's misguided is all the mindless programming language bashing. It was boring the first time you guys discussed it over and over, and it's still boring now. I love how java programmers and C++ programmers bash each other every opportunity they get. As a practical joke they should do a C++ and java convention in adjacent buildings, and by lunch time there will be a brawl.

      I've heard FORTRAN programmers make various claims about java and C++ that would have both camps frothing at the mouth. Every time someone starts one of these arguments it's incredibly fun: bash vs csh, perl vs tcl, ruby vs the world, java vs C++, vi vs emacs... It's a tool, get over it, there are more important things to bash heads for. If one guy tries to drive in a screw with a hammer, it'll work, but it's probably not the best tool for the job now is it?

    4. Re:Ah, The Joy of C/C++ by 12357bd · · Score: 1

      Memory allocation in C and in C++ is not a 'obvious limitation', sloopy programming IS. Java is not 'better' or 'worst' than C, just use the right tool for the job, and you better learn to use more than one tool if you care for your career.

      --
      What's in a sig?
    5. Re:Ah, The Joy of C/C++ by curmudgeon99 · · Score: 1

      I am fully capable of coding in C and C++. Java is not a panacea. And your point about sloppy programming being the problem is valid--but it's just much easier in C/C++ to shoot yourself in the foot than it is in Java. And as we know, mistakes and sloppiness are not always caused by stupidity--haste is often the cause. And in this go-go development environment, very few folks are not forced to code like the wind.
      So, while your naked point is valid, in practical terms--considering these memory leak bug hunts--Java is a more efficient language to code in. Evidence of this fact can be found in the majority of shops around the world--which you know code in Java.

    6. Re:Ah, The Joy of C/C++ by MightyMartian · · Score: 1

      I agree. Every language has its benefits and its negatives, of course, but no language is proof against bad or sloppy coding. Some may more gracefully handle the effects of such coding, but a hog is a hog is a hog is a hog, and I've seen crappy, memory-hogging apps written in many languages for many platforms.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
  40. Re:You're already tolerating it by using it at all by kebes · · Score: 1

    Firefox does indeed crash sometimes. On my system, it can run for weeks without problem, but certain types of content (e.g. YouTube) can crash it if it's been open that long. There's no good excuse for crashing: these problems absolutely should be fixed.

    It should be noted, however, that the "session restore" feature in Firefox 2.x reduces the impact of these crashes considerably. If there's an unexpected crash, when you reopen it, you get a dialog that says "Do you want to restore your previous session?" So, you actually don't lose any of your tabs. (Even session-dependent things, like being logged in to Gmail or entering something into a text field are restored, if memory serves.) So a crash is functionally identical to a 2-second freeze.

    Again, I emphasize that the crashing should be fixed. I'm not excusing the bugs. However, it's nice to see that they have at least coded it such that when it fails, it fails somewhat "gracefully."

  41. Re:I thought this was OSS? by Frosty+Piss · · Score: 1

    Observing the existence of a memory leak, and knowing where to fix it in your code, are two VERY different things.
    What happened to those "thousands of eyes" that make Open Source so much better than Microsoft? Isn't the argument that with soooooo many "eyes", things like this get fixed on such "high profile" projects? On e would think that this idea would be most productive on a project as visible as FireFox...

    The truth is that as fine a product as FireFox is, it's "ownership" has issues with criticism from the hoi polloi. The reason this is an issue is that FireFox sells itself as a browser for the masses, not just a "leet" geek toy. Therefore, one would expect the FireFox leadership to be responsive to the issues that the "masses" have with FireFox. This has been an issue in the past.

    --
    If you want news from today, you have to come back tomorrow.
  42. What leaks???!?? by saleenS281 · · Score: 1

    IIRC, "there are no leaks in firefox, it is your extensions causing the problems".

  43. Re:You're already tolerating it by using it at all by jsebrech · · Score: 3, Informative

    Today, FF has morphed in to something which can't be used, with plugins, for more than a couple days max without needing to be reset.

    You say that, and you compare it to IE. The only environment where I know people keep a firefox process open for days is on the mac, which doesn't run IE anymore (and btw, safari 2 leaks like a sieve too in my experience). Yes, I have to relaunch ff on my mac every few days. But on windows every time I close my last window, the browser shuts down and all memory is reclaimed. So, on platforms that are not mac, and for "normal" use patterns (i.e. don't leave a browser window with sites open for days), this is a non-issue.

    Thiis page may be informative about the issue of memory in firefox: http://plugindoc.mozdev.org/faqs/memusage.html

  44. 49GB! by pergamon · · Score: 1

    Yes, I sure hope that I won't have to deal with massive memory usage anymore: http://moore.cx/images/firefox.png

    1. Re:49GB! by Bandman · · Score: 1

      Yea, but what extensions do you have installed? /just kidding //ducks and runs

  45. Firefox memory leaks - (X11 specific) by Alien+Being · · Score: 5, Informative

    The biggest memory leak does not show up in firefox itself. It shows up in the X process:

                TIME+ PID USER CODE VIRT SWAP RES SHR S %CPU %MEM P COMMAND
          391:42.00 30262 root 1712 864m 481m 383m 5636 R 20.5 38.0 0 X :0 -auth /home/me/.serverauth.30245
            19:54.97 5473 me 9.9m 350m 202m 148m 18m S 0.0 14.7 0 firefox/firefox-bin

    xrestop shows this:

          res-base Wins GCs Fnts Pxms Misc Pxm mem Other Total PID Identifier

          3600000 295 62 1 2664 119 621592K 12K 621604K ? Firefox Working to Fix Memory Leaks - Mozilla Firefox

    In other words, X has over 600MB of memory holding pixmaps for firefox. This grows every time I open a page/tab with images in it.

    Closing pages/tabs does not free the memory from X, nor does lowering firefox's various cache settings in the preferences dialog and about:config. Quiting firefox causes X to release the memory. I have to do this at least once a week.

    1. Re:Firefox memory leaks - (X11 specific) by Colin+Smith · · Score: 1

      It's not a leak. It's a cache.

      --
      Deleted
    2. Re:Firefox memory leaks - (X11 specific) by Anonymous Coward · · Score: 0

      It's not a cache, it's a pixmap. And it was discussed recently in Xorg thread.
      Current "solution" is timer for each generated pixmap that frees it after ~2 seconds. Wonderful!

    3. Re:Firefox memory leaks - (X11 specific) by Anonymous Coward · · Score: 2, Informative

      Congratulations! You didn't read the fucking article.

      The very first optimisation they discuss is: "Federico Mena-Quintero submitted a patch to make Firefox discard decompressed image data after five seconds (bug 296818)"

      Click the link in the article - it leads to discussion about how X is holding all this image data for Firefox and how it's been fixed to not do that any more.

  46. The memory bug is also a CPU hogging bug. by Futurepower(R) · · Score: 5, Informative

    What people call the memory gobbling bug is actually also a CPU hogging bug, and it is still present in Firefox version 2.0.0.7, even though the bug was reported perhaps 5 years ago. Versions 2.0.0.7 and 2.0.0.6 are far more stable than previous versions, but Firefox is still the most unstable program in common use.

    The CPU hogging bug in Firefox may be caused by inadequate allocation of resources. Maybe the chaining of the event handler code with numerous windows open is an issue.

    Firefox crashes Microsoft Windows. Apparently there is a bug in Windows, or more than one, that causes the entire Microsoft Windows OS to become unstable when Firefox starts CPU hogging. In any case, the only way to get Windows back to a stable state after killing Firefox is to re-start the computer.

    It's interesting that Firefox can be used to show that Windows is an unstable OS, in some cases. Linux is completely stable; it is only necessary to kill Firefox to regain resources.

    The Firefox CPU hogging bug occurs only during heavy use of Firefox, with many Windows and tabs open for several hours, such as happens when someone in purchasing in a corporate environment is researching computer parts. The problem is made worse if the computer is hibernated or put in standby.

    If you open a lot of windows and tabs in Firefox on a laptop, and put the laptop in and out of standby, you will eventually notice that the laptop fan is running all the time, even when there is no activity. That's the CPU bug, and it can potentially shorten the life of your laptop. The fan is often the laptop component that fails first.

    It is interesting to note that the latest version of Opera also exhibits CPU hogging, but much less frequently. However, using Opera is not as comfortable because of poor design decisions in Opera.

    See: Firefox is the most unstable program in common use.

    Firefox developers apparently game the system by abusing those who report bugs: Mozilla Foundation Top 20 Excuses for Not Fixing Firefox Bugs.

    Firefox development sometimes resembles playing.

    Basically, this seems to be the underlying problem: Winifred Mitchell Baker, the CEO of Mozilla, is a socially uncomfortable lawyer who became CEO when no one thought there was an opportunity. Now Mozilla Foundation is making millions from designating Google as the default search engine.

    Winifred has insufficient control over those who work for her, because she doesn't understand what they do. The Firefox CPU hogging and memory gobbling bug would take some serious troubleshooting to find, and no one wants to do the work, apparently.

    1. Re:The memory bug is also a CPU hogging bug. by Anonymous Coward · · Score: 0

      The hive-mind is not willing to engage in 'critical thinking'.

    2. Re:The memory bug is also a CPU hogging bug. by colfer · · Score: 3, Informative

      Some valid points, but FF has a fix for the Hibernate bug, maybe more fixes coming, see Bug 213637 and its friends. That fix will be in 2.0.0.8, while 2.0.0.7 was an emergency release for the "Quicktime abuses Firefox command line parameters" vulnerability.

    3. Re:The memory bug is also a CPU hogging bug. by colfer · · Score: 1

      But I've never seen it crash WindowsXP and I think you mixed in complete FUD with your post.

    4. Re:The memory bug is also a CPU hogging bug. by Anonymous Coward · · Score: 0

      Thank you so much! I have two XP machines that FireFox randomly crashes from time to time. It drives me insane and it's great to see I'm not the only one who is having this issue.

    5. Re:The memory bug is also a CPU hogging bug. by Verte · · Score: 2, Interesting

      Maybe the chaining of the event handler code with numerous windows open is an issue. I think you've hit the nail on the head. Here's an experiment. Find a page with a heap of links on it. Make sure what they link to is not too huge, and doesn't open any plugins, or anything. Now, quickly, try to open the links by right clicking and choosing 'open in new tab'. You should be spending a while waiting for the menu to open. That the page you are viewing becomes unresponsive while a new tab is being created points at really horrible threading. It seems the browser is, to some degree, doing work the operating system should be doing- managing multiple [conceptual] threads.

      I guess that maybe this is a little off topic, but I think it shows that there are certainly resource problems in the tab implementation. Someone suggested separate processes for tabs with different SLDs, and complete JS & Plugin environment clean when changing SLDs, which could practically eliminate many XSS problems I assume [note: I haven't done my research on that one].
      --
      We at slashdot are scientists, specialists and kernel hackers. Your FUD will be found out.
    6. Re:The memory bug is also a CPU hogging bug. by slapout · · Score: 1

      "However, using Opera is not as comfortable because of poor design decisions in Opera"

      Ok, as an Opera user, I've got to know: which poor design decisions are you referring to? Is it lack of extensions or the GUI or something else?

      --
      Coder's Stone: The programming language quick ref for iPad
    7. Re:The memory bug is also a CPU hogging bug. by mcvos · · Score: 1

      Ok, as an Opera user, I've got to know: which poor design decisions are you referring to? Is it lack of extensions or the GUI or something else?

      Opera has its limitations, but so does Firefox. I tend to have dozens of webpages open at a time, and leave my browser on for days or weeks. Firefox can't handle that, so for that reason, I just installed Opera on my work PC. From now on, I'll be using Firefox for the sites I build and need to test (Firefox has some excellent extensions that help debugging sites), and Opera for sites that contain information I need, so I can leave those open for as long as I like.

    8. Re:The memory bug is also a CPU hogging bug. by Burz · · Score: 1

      What triggers the CPU hogging for me on Linux is the presence of enhanced GTK theming in the system.

      For instance, after I installed Kubuntu and added Firefox, FF looked a little clunky but worked smoothly with no CPU hogging. But then I installed a Gnome app and bunch of Gnome stuff got installed along with it. From that point on, Firefox looked nicer but always used nearly 50% CPU after 20 minutes of brisk usage where closing web pages didn't help.

      Workaround: Changing the Firefox theme to something other than 'default' (I eventually chose 'iFox Smooth') which also looked nice, but the idle CPU usage went below 1%. The default FF theme is more extensive than most, it seems, and the way you can tell is by comparing how the dropdown menus look. The FF default menus will look quite fancy with all of the Gnome stuff installed, while a user-installed theme will result in flat menus.

    9. Re:The memory bug is also a CPU hogging bug. by lpq · · Score: 1
      Futurepower wrote: memory bug is also a CPU bug

      I see, mostly, problems with CPU usage as Firefox remains "up" longer. Though very often, the problem I see manifests as an apparent, but false slowdown of most internet sites.

      Firefox crashes Microsoft Windows. ... the only way to get Windows back to a stable state after killing Firefox is to re-start the computer

      I've seen no evidence of this one -- how can one reproduce? I have seen FF get worse and worse -- and restarting FF solves the problem, but haven't seen Windows die -- but then FF is limited to 1 CPU(Core) due to programming limitations (like buffer overruns, non-reentrant code will plague us for the next decade or two).

      If you open a lot of windows and tabs in Firefox on a laptop, and put the laptop in and out of standby, you will eventually notice that the laptop fan is running all the time, even when there is no activity. That's the CPU bug, and it can potentially shorten the life of your laptop. The fan is often the laptop component that fails first.

      Let me understand. Your laptop's fan turns on and stays on even though there is no CPU (or system?) activity and you believe this is a CPU bug? Why wouldn't this be a fan bug? Or a bug of the ACPI system? More often than not, those bugs are laptop or manufacturer specific.

      It seems that most of your quotes supporting your case are quotes of yourself. That's hardly supporting evidence.

      Try setting firefox's CPU priority to "idle" (4), and see if that changes anything. Just a guess, but since I don't see FF destablizing other progs, I'm guessing it's because it doesn't affect the other CPU's on my system (its display manager is single threaded and will remain so without a rewrite, I'm told). So maybe if you give your FF lowest priority, other programs (windows, thunderbird) won't be so affected.

      It's possible FF is causing bugs in other programs to be displayed "more often", in the way that heavy CPU load can cause more race-conditions in the code to be hit more frequently.

      Not an ideal solution, but restart FF "daily" (or whenever you start to notice a significant slowdown"). The "Restart with Tabs extension is great for helping to "save your place".

      Perhaps the code would be more "reentrant" if it also released memory more cleanly?

      Perhaps switch FF to a language with auto-garbage collection? (Perl anyone? :-))...

    10. Re:The memory bug is also a CPU hogging bug. by enmane · · Score: 1

      Mod parent up as s/he's totally correct.

        I'm TIRED of Seamonkey doing this to me. There I am, late night, surfing some research papers but I'm too tired to finish the reading. I put the laptop into hibernate mode to resume the next day. Almost, without exception, Seamonkey will hang and drive my cpu usage up to 100% upon resuming the surfing.

      I'm getting VERY tired of this and I'll be off to install Opera. At first I wasn't sure if it was my system but the fact that someone else knows about this to assures me that I'm not an isolated incident. Time to give Opera a go.

      Anyhow, I'm tired of going back through my history and re-opening the read and the not-read pages in search of the sites that I didn't get to. Thanks for the ride Mozilla but enough is enough!

    11. Re:The memory bug is also a CPU hogging bug. by WryCoder · · Score: 1

      I'm a heavy Opera user also. You will find that Opera's memory usage gradually increases, especially when viewing multimedia. I interpret this to be Opera adding memory to its arenas and never returning it, as opposed to leaks. After a session of heavy video, I usually have to restart Opera. But I only have 512 MB of physical and it's not unusual to get 400 MB into virtual in one of those sessions, which really drags down the system.

      Also, lately I'm having a lot of trouble with Opera and Flash. Opera will freeze quite often, but not if I disable the plugins. I'm using Opera 9.02 on Arch and 9.23 on Debian Sid, and the latter is no improvement.

      Opera is much better than Firefox as far as usability goes, and I hope the Flash problem gets fixed soon.

    12. Re:The memory bug is also a CPU hogging bug. by kayditty · · Score: 0

      You could just middle click, instead of right clicking. FYI, I've experienced this problem with Firefox to varying degrees, but not in the way described. I've loaded over 120 tabs in a single Firefox window before, without much difficulty. I've no problems with opening and closing lots of tabs, and neither have I experienced the "CPU hogging" bug aforementioned.

      But it does use lots of memory sometimes. I just close it and restart (I'm using 1.5 with the Session Manager extension, so I don't lose anything when I do so), and this never causes Windows itself to crash on either of my Windows 2000 desktops.

      YMMV.

  47. About time by teslatug · · Score: 1

    So have they finally acknowledged that Firefox is a memory hog instead of just blaming users for not understanding features? I can't believe how much memory Firefox uses just from the start. The memory buffers use up 3/4 of my memory with an empty, just launched, instance of Firefox. Where does all that go? Sure buffers can be cleared if needed, but I'd rather have that memory free (which I'm guessing can be allocated more easily than buffered memory, but maybe I'm wrong). Either way, I'd like to know why it spent time allocating buffer memory without even a single page loaded.

    1. Re:About time by BZ · · Score: 2, Informative

      > So have they finally acknowledged that Firefox is a memory hog instead of just blaming users

      I have yet to see an actual Firefox developer blame users for memory usage issues. Anyone actually working with the code knows that there are problems that need fixing.

      What I _have_ seen are fanboys who've never looked at the code making claims about what is or is not leaking without a basis in reality.

      The fact is:

      1) There are some leaks in Gecko
      2) There are some leaks in the Firefox UI
      3) There are some leaks in extensions
      4) There are some behaviors in all three that are not leaks but do
              lead to prolonged usage of large amounts of memory.

      By "leak" above I mean "memory not deallocated until program shutdown", which is a looser meaning than the typical meaning of "leak" as "memory the program does not deallocate at all". In the end, the user doesn't care which is happening.

      All four items above need to be addressed, though for item 4 there is the obvious question: is there utility from the user's point of view in holding on to that memory, and does that utility outweigh the memory usage. Put another way, a 5MB RAM page cache is clearly too small and a 500MB one is clearly too big (on modern hardware). The question is what a "good" size is.

      > The memory buffers use up 3/4 of my memory with an empty, just launched, instance of Firefox.

      You mean on Linux? A lot of that is disk buffering into RAM, right?

      > but maybe I'm wrong

      You're wrong.

      > allocating buffer memory without even a single page loaded

      To start a program you have to read it from disk. Linux in particular very aggressively buffers disk into RAM; it probably has not only all the files touched (not necessarily still open!) by Firefox as it starts, but various other programs you've started as well, the Firefox disk cache, etc, etc.

  48. Memory Leaks is the most trivial of issues. by Wolfier · · Score: 2, Insightful

    How about making at least the Javascript engine and the Flash plugin framework multi-threaded?

    IE has been lowering the CPU priority of Flash applets for years so if you have 100 Flash ads open, it won't bog down your browsing. On Firefox, try opening a couple of tabs in Yahoo and it basically grinds to a halt.

    It used to be that in NS4, I could see "nsplugin" process so I can renice that to achieve the same effect. On Firefox, it's not possible.

    And, if you happen to leave Gmail open, my CPU usage (lowly Sempron) will hike to 30% twice a minute. On IE the CPU usage stays low. I suspect it's due to a multi-threaded Javascript engine in which individual thread can be prioritized.

    1. Re:Memory Leaks is the most trivial of issues. by Bandman · · Score: 1

      I suspect it's google chat, and all that AJAX stuff happening live, but on my G4 powerbook, going to gmail results in almost solid 100% CPU utilization.

  49. Re:Glad the issue is getting some priority, but .. by Deagol · · Score: 1

    Must be something else. I run Firefox 2.0.0.7 under Windows 2000 on a ~500MHz laptop w/ 160MB of memory, and it doesn't ever lock up on me. No, it's not fast, but it's quite stable and usable (in spite of the 800x600 max resolution). Something else is likely the cause of your instability, like a plug-in or using a later version of Windows.

  50. Now stop denying other issues, too, Firefox! by KWTm · · Score: 1

    The thing that has irritated me about this is that for a very long time, the FireFox leadership has insisted that there where no memory issues

    Agree! And you know what was even more irritating than the official leadership denying this? The dozen Slashbots who would automatically throw themselves sacrificially onto the incoming path of your criticism, saying, "There's no memory leak! Firefox is just reserving 3GB of memory to
    cache all your huge web pages! Like that bloated Google main page!"

    And now Mozilla is saying, "You know that memory leak that didn't exist? Well, we're fixing it now." Did someone take lessons in Microsoft Marketspeak?

    Here's something else they should stop denying: the fact that Firefox is frick'n bloated. It needs to be pared down to a skeletal size, and everything moved to an official series plug-ins/extensions/add-ons (or whatever they're called these days) that can be installed by default, but which can be removed to get the desired responsiveness and small memory footprint. But when Chris Beard of Mozilla was interviewed on Slashdot, he said:

    I don't know if there's a need for "official" extensions ...
    Yeah, buddy, that's because all your extensions are an integral inseparable part of Firefox. You're just afraid of the complexity of testing and debugging extensions, aren't you?

    I still use Firefox. I still use unsigned extensions because that seems to be the standard, and for some extensions there just aren't any signatures. That's because Firefox has Adblock Plus and NoScript. The minute these appear in Konqueror, I'm saying goodbye to Firefox.
    --
    404555974007725459910684486621289147856453481154 in hex is "You sank my Battleship?"
    [GPG key in journal]
  51. Firebug work alike for IE7 by LeedsSideStreets · · Score: 1

    I use FF on my desktop at work with one or two plugins (FlashBlock and FireBug, mostly).
    I believe there is a Firebug work alike for IE7.

    I think it's called Firefeature, though.
    1. Re:Firebug work alike for IE7 by MBCook · · Score: 1

      I only dabble in web stuff, my of my work is back-end. I use Flashblock to speed things up and keep my CPU use down, and Firebug for those few times I need to figure out why some CSS thing isn't displaying right. There are similar things for other browsers. The inspector built into Safari 3 is very nice.

      --
      Comment forecast: Bits of genius surrounded by a sea of mediocrity.
  52. Why so much denial? by Futurepower(R) · · Score: 0, Troll

    Sometimes the sociology of Firefox bugs is more interesting than the bug itself.

    The parent comment has been marked Troll and Flamebait. (Numerous other Slashdot comments discussing the same CPU and memory hogging bug have been marked +5.)

    Why so much denial?

    1. Re:Why so much denial? by Anonymous Coward · · Score: 0

      Why? Because Firefox is one of Slashdot's sacred cows, like Wikipedia, anime and robots. You don't dare question them or else you get modded a troll.

      I do question the above poster's complaint about Opera's design issues. I can't stand Firefox on Linux precisely because of the ass-backwards interface thanks to the FORCING of the GNOME HIG on the user. I use KDE, why can't it take that into consideration without installing some ugly hack? Actually this is a problem with all GTK+ apps now, which is why I actively avoid them if I can.

      I live half my time on Windows too and I'm sick of having the interface moved around on me when I flip between machines. With Opera it's all the same regardless of platform--I can live with that. Opera is just better behaved than Firefox.

  53. Automatically != Efficiently by ClosedSource · · Score: 4, Informative

    A well-written C++ program is going to free memory much faster than a GC can. The value of GC is that you don't have to worry about forgetting to free memory, it will happen - eventually.

    1. Re:Automatically != Efficiently by naasking · · Score: 1

      A well-written C++ program is going to free memory much faster than a GC can. The value of GC is that you don't have to worry about forgetting to free memory, it will happen - eventually.

      Vague and unsubstantiated statement. This is not a question of C++ vs. GC, this is a question of manual memory management algorithms (MMM) vs. automatic memory management algorithms (AMM), and what is a better fit given your application's resource usage patterns. For instance, the libc MMM produces fragmentation, whereas a compacting GC yields higher locality, so if your application induces a great deal of fragmentation and benefits greatly from higher locality, then GC will likely be more optimal.

      Further, there are other AMM algorithms besides GC (see region-based memory management) which approach the efficiency of customized, arena-based MMM, which is as efficient as you can get; the "unsolved" problem is automatically inferring where regions should be allocated and freed based on the source code; workable solutions to this problem have been recently published, so the next few years look to be very interesting indeed.

    2. Re:Automatically != Efficiently by Nicolay77 · · Score: 1

      Your arguments go to the sink the moment that I allocate 90% of my objects in the stack.

      I don't use new if I don't need it.

      Of course, if we were talking about some other language besides C++ your arguments would have been unbeatable.

      --
      We are Turing O-Machines. The Oracle is out there.
    3. Re:Automatically != Efficiently by naasking · · Score: 1

      Your arguments go to the sink the moment that I allocate 90% of my objects in the stack.

      I don't use new if I don't need it.


      If your allocation patterns follow purely stack semantics, then region-based memory management is as efficient as you can get. It's more efficient than stack-allocating values since it minimizes the copying inherent to C/C++ value semantics.

    4. Re:Automatically != Efficiently by Anonymous Coward · · Score: 0

      And a poorly-written Java program is going to allocate memory much faster than well-written C++ without GC can.

    5. Re:Automatically != Efficiently by MartinG · · Score: 1

      Nice theory. Where is your evidence to support it?

      --
      -- MartinG To mail me: echo kewyjlcxyzvjfxbqwh | tr bcefhjklqvwxyz .@adgimnoprstu
    6. Re:Automatically != Efficiently by Anonymous Coward · · Score: 1, Informative

      And many people seem to forget that a GC-backed system CAN also LEAK memory. This can happen easily when a programmer forgets to throw away references to certain objects. (For example, when lots of objects are stored in a large table, and are subsequently forgotten, but the table is still referenced.)

  54. Memory leaks by Per+Abrahamsen · · Score: 2, Informative

    Real programmers can code memory leaks in any programming language.

    (I'm not kidding, it is very easy to accidentally use a strong pointer, where a weak pointer should have been used. Especially in languages that doesn't support the later concept :-)

  55. Permenant usage for digital sign required IE7 by travelin_light · · Score: 1

    I know this is not code level, technical, observation but a real world comparison. I use 4, 22in LCDs in my real estate office window to advertise houses. The web page they display is javascript light, one to change the logo every 30 seconds. Each page has FLIKR applet to show a slide show of the property. The 4 firefox browsers will grind the system to a halt within 3 days (P4 630mb of RAM). The same 4 pages shown continously in IE7 will last 8-10 days. Either way it is crap b/c they should not leak at all, they are web browsers with thousands of peole wokring on them. Increased quality review and assurance of core functionality would probably help here. Thankfully memory is so cheap I am bumping up to 3gb. Not to go quicker but to last longer between re-boots...

    1. Re:Permenant usage for digital sign required IE7 by BenoitRen · · Score: 1

      Or you could just shut the computers off for the night. Saves electricity, too.

    2. Re:Permenant usage for digital sign required IE7 by travelin_light · · Score: 1

      Decent idea if it were not a store front marketing tool... It attracts passers by really well.

    3. Re:Permenant usage for digital sign required IE7 by westyvw · · Score: 1

      It would be interesting to see you continue this test. How about Opera, Konq or Safari? I would be most interested in seeing how different OS's perform with different browsers. Whats also interesting is that you should be able to do that with a p2-400 and 128 megs ram. Jeez.

  56. Funny by number6x · · Score: 1

    If I had mod points, you'd get a funny!

    Are the moderators asleep today?

  57. Re:Why I tolerate it by dvice_null · · Score: 1

    > (so much for the "millions of pairs of eyes" thing, huh?)

    The story is about how many leaks have been found and fixed. How do you see that as a bad thing? Or do you mean that with open source development model, these bugs shouldn't been there in the first place? Well, Firefox is based on Mozilla Application Suite, which is based on Netscape Communicator, which was developed as closed source application, before it's source was released in 1998.

    http://en.wikipedia.org/wiki/Mozilla_Application_Suite

  58. java memory profile by sentientbrendan · · Score: 4, Interesting

    > Actually, the big language culprits would be those with auto-garbage collection,
    > etc. as they tend to have lazier programmers

    Actually, it isn't lazier programmers. The problem is that existing garbage collection implementations have horrible memory profile.

    If you look at the memory usage of a java program, it's about as bad as a c program that does nothing but leak memory. Practically speaking, java does little to free memory until it has *run out of memory*. Then when it does run out of memory and it needs to clean things up, things get slow as hell.

    >The real answer is doing your job right, and using the right tool - which is not necessarily
    >the easiest tool to use either.

    Yes! Unfortunately, academics and many novice programmers (who just got finished being trained by academics) are unfamiliar with the powerful tools available like C++. Going to school can give you the mistaken impression that garbage collection is *a good thing* because everyone uses it there. The truth is that C++ is a very complicated language with a steep learning curve, but that many times it is simply the only tool that is suitable for the job.

    If your program is IO bound, like a web application front end, you are in a great position, because essentially *any* tool will do the job, even if the performance is abysmal. You can use java, ruby, or whatever. And you should, becuase those languages don't present you with the complexity of c++.

    Unfortunately, many programs *are not IO bound* and the performance and memory profile of the underlying tool are very important. This is most true of interactive non parializable programs. So, a good example would be bittorrent programs. Consider utorrent vs azureas, one in c++ and one in java. utorrent is fairly light weight and easy to use because of its performance characteristics. Azureus is a powerful and well engineered program, but it sure as hell is slow and chews up memory.

    1. Re:java memory profile by tknd · · Score: 2, Interesting

      utorrent is fairly light weight and easy to use because of its performance characteristics

      I call bs. utorrent is not easy to use because of performance characteristics. In some ways I find it stupid to use. Why do I have to use a 2nd level context menu to set a specfic upload/download rate maximum for a specific item? Where are my keyboard shortcuts? utorrent only wins on usability by copying what already exists. It's not a bad strategy, but I'm not sure I've seen anything greatly innovative in terms of UI in utorrent.

    2. Re:java memory profile by Anonymous Coward · · Score: 0

      > Practically speaking, java does little to free memory until it has *run out of memory*.
      > Then when it does run out of memory and it needs to clean things up, things get slow as hell.

      1. as long You use *any* memory managment scheme, at some point allocation/deallocation result to a performance slowdown. Even in c++, if Your memory gets fragmented (and it gets for sure), You will need to concatenate free bits of memory into larger chunks. Yes, java's gc breaks execution for a time - but it mus happen to c++ program as well. Maybe not so often - but i am sure it takes longer time.

      2. many c++ programs rewritten to use gc resulted in boosted performance.

      3. gc "slow as hell"?? pardon me, sir - but this is not true anymore. Just try netbeans or eclipse - they are maybe not as quick as vi editor - but they are doing huge work for of user.

    3. Re:java memory profile by Logic+and+Reason · · Score: 1

      If you look at the memory usage of a java program, it's about as bad as a c program that does nothing but leak memory. Practically speaking, java does little to free memory until it has *run out of memory*. Then when it does run out of memory and it needs to clean things up, things get slow as hell.
      I don't think this is actually true; if you have hard numbers, I'd like to see them. As far as I know, Java garbage-collects memory as soon as it's no longer reachable from the main program, which has nothing to do with running out of memory.
    4. Re:java memory profile by Anonymous Coward · · Score: 0

      It does not, and could not with any scheme other than reference counting. You can configure your VM to output when a collection is performed. It will collect when the nursery fills such that an allocation would fail. The specific heuristics used will depend on the specific collector used by the VM, but that is the general policy.

      If you are a programmer, you should ask yourself why you think that garbage collection is magic, and where exactly your formal education failed you. I suggest reading the literature at your earliest convenience.

  59. After the memory fixes.. by Krojack · · Score: 1

    Add some threaded (or better threaded) support... I'm sick of one tab loading something like a Flickr.com page and while its loading I'm looking at other tabs and unable to scroll up and down the page...

  60. Leaks void my warranty by LM741N · · Score: 1

    Any type of liquid damage voids my service contract.

  61. No it is not! by 12357bd · · Score: 1

    It's an act of balance, and the problem is not _always_ "sloppy coding". It is the increasing complexity of these apps, combined with user demands which push the development towards low-level development languages.

    A memory leak is a programming error, an implementation failure. Complexity is not an excuse for the existance of errors at the implementation level, because can be easily avoided with proper programming methodology.

    It is a shame that we assume that a complex application has to have memory leaks! I am sorry but after 30+ years of programming I cannot accept that kind of statements as being 'realistic', they are just 'sad'.

    Users don't create memory leaks, only BAD PROGRAMMERS do.

    --
    What's in a sig?
    1. Re:No it is not! by SplatMan_DK · · Score: 1

      I respectfully disagree.

      I have seem programming projects grow beyond their scope many times. Here is a story on what might happen (all very theoretical and totally manufactured):

      A bunch of people are working on a browser. They are a very philanthropic bunch so they work on the new browser from home, free of charge, in the interest of making a free alternative to one of the worlds biggest commercial browsers.

      Programmer A, let's call him Anthony, is working on the URL entry field. He makes a chunk of code intended to help users who mistype the URL, and which makes the browser "guess" what the user actually intended. Perhaps a forgotten "w"? Or a URL without "www" to a domain which can't handle the absence of a host name (no URL forwarder)? And if all else fails, do a search using the default web search engine and display the result? Don't argue if this "feature" should be in the browser or not - stay with me for a minute here: The users have requested this feature, and Anthony is coding it. No big deal.

      As part of his work, Anthony makes a few additions to a class or function library which handles Strings. He makes a procedure/method which automatically strips a string of "w." and "ww." if they are at the beginning of a string. He calls his procedure/method "stripUserURLCrap". And it works perfectly. Anthony is happy.

      A few months later programmer B, let's call him Bill, is working on the parameter list in the browser. You know... the one you can display by typing "about:config" in the URL field. Bill wants to add line which displays the latest URL typed by the user. He looks at Anthonys code, and upon understanding what Anthony implemented in "stripUserURLCrap" he chooses to display two values: the string containing the actual user input, and a second string with all the strings "stripUserURLCrap" actually tries to resolve if the first original string failed to resolve a normal page. And it works perfectly. Bill is happy. Anthony is happy.

      Another few months later programmer C, let's call her Carol, discovers a buffer overflow error in the URL entry field. It turns out that if a user puts one billion "w." instances in the browserstring "stripUserURLCrap" will crash because the string is too long and nobody cared to check for morons typing one billion "w." strings in the URL field. She also discovers that the reason for the problem is that in order to compensate for empty strings or null objects in the URL field, "stripUserURLCrap" always serializes its input and inserts it into a new string - to which memory has to be allocated.

      Before a lot of big and fancy security firms swarm all over this issue, Carol decides to fix the problem. She changes the way "stripUserURLCrap" works, and makes sure it can now handle a billion "w." entries and that it can also handle null objects. And it works perfectly. Carol is happy. Bill is happy. Anthony is happy.

      A week later end-user J, let's call him Jesper, decides that "about:config" should be his start page. He sets the default page to "about:config", and goes to sleep. The very next morning when he opens the browser in order to check the weather forecast ... WHAM! the browser crashes before it can even display the config page.

      Whap happened? Well, the config page display a lot of strings, right? Values and parameters. One of them shows the value of the last typed URL from the user. And guess what: where the list was expecting a string there is suddenly a null value. The "last.typed" property returns a null object which is an illegal value the list can't handle. It expects strings.

      Now answer this question: who made a mistake?

      Did Anthony make the mistake which made the config-list crash?
      Did Bill make the mistake which made the config-list crash?
      Did Carol make the mistake which made the config-list crash?

      They would each be in a position where they could argue, that they personally made no mistakes. And perhaps even that programmer D (his name was

      --
      My security clearance is so high I have to kill myself if I remember I have it...
    2. Re:No it is not! by Anonymous Coward · · Score: 0

      They would each be in a position where they could argue, that they personally made no mistakes. And perhaps even that programmer D (his name was Daniel) is responsible, because he made a stupid config-list which couldn't handle null values.

      My boss would say that it was actually Project Manager E (his name is Ethan) who failed to plan important details of the project, and also failed to implement proper QA procedures.

      But when the sun sets, and they all get together for a beer at the local pub, they realize that none of them were really to blame.


      And I must respectfully disagree with this assertion. Programmer D is primarily at fault, and no, there's no excuse for not handling the null-value. Project Manager E is also at fault for exactly the reason you stated, no maybe about it. I'm not saying that we should expect D and E to be 100% flawless, but I do expect them to recognize, accept and admit fault.

      Someone will now say "Why should Programmer D check for a null-value in cases where it cannot occur?" Well, it depends on what is really meant by "cannot occur". Let's say that Programmer D calls a C++ function to get the "last typed URL", PropValue GetPropValue(const PropValueKind& pvk);. Here we have a language-level construct (returning a copy of an object) to enforce "cannot occur", so it's only reasonable if Programmer D doesn't handle an impossible null-value (no pointer, nothing to do). So, if Programmer Z slipped in and changed the return type to PropValue const* (negating the "cannot occur" semantics), then either local compilation or the automated build (Project Manager E surely has this in place) will fail. Programmer D is still not at fault, and Programmer Z clearly has a lot more work ahead of him, or he must coordinate his changes with the efforts of (many) others.

      Now, let's say instead that Programmer D calls a Java function to get the "last typed URL", public PropValue getPropValue(PropValueKind pvk);. There is no "cannot occur" enforced here; the return value could cause an NPE (regardless of what the associated JavaDoc might claim). If Programmer D fails to handle an NPE, he's at fault. If that deficiency survives in the deployed application, it's also Project Manager E's fault, and arguably doubly Programmer D's fault because his unit tests also failed.

      BTW, not trying to pick on Java or promote C++ here - could have used Python (or whatever) instead of Java, and could have used Ada (or whatever) in place of C++ to illustrate the tangential issue.

      - T

    3. Re:No it is not! by 12357bd · · Score: 1

      Problems with NULL values? :)

      The program crashed because an 'unexpected' NULL value... well what where the conventions used in the project? I mean, it was 'ok' to return a NULL object, or it shoud return an empty string?

      Both results are acceptable 'per se', but that kind of things are important at the convention level, it seems for your example that the team doesn't have an established methodology on that kind of things, that was probably the root of the problem (and I could anticipate a few more.. ie: to add a method to a tipically 'base' class as String, should only be allowed under strict circumstances!). Again , methodology is a key factor for code quality.

      Complexity of the project does not relate to complexity of the parts, without proper methodology, parts become mingled (your String example) and that's where things start to go wrong.

      btw: I make mistakes (only human here), but i am responsable for my mistakes, so no memory leaks on my code, every malloc() had to have a proper (one and only one call to) free(), no excuses.

      --
      What's in a sig?
    4. Re:No it is not! by SplatMan_DK · · Score: 1

      And I must respectfully disagree with this assertion. Programmer D is primarily at fault, and no, there's no excuse for not handling the null-value. Not even if the convention for the list in question was, that it should always be supplied with strings? Daniel may in fact have specifically written in both the documentation and comments in the code, that only string values are valid?

      Project Manager E is also at fault for exactly the reason you stated, no maybe about it. I'm not saying that we should expect D and E to be 100% flawless, but I do expect them to recognize, accept and admit fault. Did you not ever participate in a project, where time and use of resources was also a factor? A significant factor? (If not, I wonder what kind of projects you work on, and what kind of project manager controls them).

      There is not an unlimited amount of programming hours for every project. So, as I said, flawless code is reserved for nuclear reactors and NASA rovers. The rest of us mortals will have to make do with "out best efforts under the circumstances". That is how the real world works. Realistically.

      :-)

      - Jesper
      --
      My security clearance is so high I have to kill myself if I remember I have it...
    5. Re:No it is not! by SplatMan_DK · · Score: 1
      Based on your post I think we pretty much agree on how the world works. :-) But I have a single question:

      (and I could anticipate a few more.. ie: to add a method to a tipically 'base' class as String, should only be allowed under strict circumstances!) I use Smalltalk which is an OO platform. I extend classes and use the polymorphic properties of the programming environment a lot. For me, adding a new method to the String class is easy, trivial, and virtually free of risk.

      Why should extending the String class be under strict control? (It is an honest question)

      :-)

      - Jesper
      --
      My security clearance is so high I have to kill myself if I remember I have it...
    6. Re:No it is not! by 12357bd · · Score: 1

      Well, that's almost a basic question...

      Extending a base class (String,Object,whatever) usually changes the behaviour of the basic toolset, and that's something that all the developers have to be aware, and that's an extra source of problems/work. I prefer to let the basic libs/classes untouched, that way any programmer can know how things are suppoused to work at the 'starting' level.

      Also, basic classes such as String or Objects are used in a lot of places, and that means a major probability of unexpected side-effects.

      Don't get me wrong, if it's a personal/educational/learning project it is ok to make that kind of changes of the base classes for the sake of simplicity and ease of use/programming, but they don't translate well (in fact they don't translate at all) to a more formal/rigorous/proffesional methodology.

      --
      What's in a sig?
    7. Re:No it is not! by SplatMan_DK · · Score: 1

      I am not sure the problems you describe translate to the world of Smalltalk. :-) - Jesper

      --
      My security clearance is so high I have to kill myself if I remember I have it...
    8. Re:No it is not! by Anonymous Coward · · Score: 0

      First, thanks for the thoughtful response; ACs don't seem to get that often here. I think we actually agree more than it seems, and eventually that should be apparent in this reply. And sorry for the delay - got busy.

      Not even if the convention for the list in question was, that it should always be supplied with strings?

      Not even then. If Daniel cannot write the code so that the convention is enforced at build-time, he must write unit tests (or do something, at least) to find the problem post-build, presumably as part of an automated process.

      Daniel may in fact have specifically written in both the documentation and comments in the code, that only string values are valid?

      That's commendable, but to my mind it doesn't absolve him of the responsibilities I just noted.

      Did you not ever participate in a project, where time and use of resources was also a factor? A significant factor?

      There is not an unlimited amount of programming hours for every project. So, as I said, flawless code is reserved for nuclear reactors and NASA rovers. The rest of us mortals will have to make do with "out best efforts under the circumstances". That is how the real world works. Realistically.


      Yes, I have worked in constrained projects. We're human, and we make mistakes even in optimal circumstances. Schedule pressure (and inadequate tools, corporate politics, and so on) can only be expected to lead to a greater frequency of human errors. As you say, we do not have unlimited time available, and I think we generally agree on this (but see my quibble later). And I don't expect flawless programming (nuclear plants and NASA vehicles aside), which I did affirm in a part of my post that you quoted.

      So, I think we mostly agree, but the part of your prior post which motivated me to respond was this:

      But when the sun sets, and they all get together for a beer at the local pub, they realize that none of them were really to blame. It was simply a situation which nobody had foreseen, and which they probably COULD have avoided with a lot of planning and scoping, but only if they spent 95% of their project time making detailed plans, code reviews and internal APIs - all which would make the project more secure but also MUCH more time consuming and a lot less productive.

      Once they're at the bar and free of the office environment, I believe that they would better serve themselves by identifying and accepting fault (without ego, if possible), recognizing that they should have avoided the problems rather than merely could have done so, and then discussing how to improve things (in my experience, this is best done before too many beers are consumed). Of course, the rational outcome of that conversation might be that "there just isn't enough time to do these things", "there aren't enough people to help with this", and so on. Such conclusions might be perfectly valid. However, it doesn't indicate to me that Daniel and Ethan are not at fault, but instead that they must understand they're involved in a project where it is more likely they will make such mistakes, and they have little or no opportunity to avoid that. Increased schedule pressure (and whatever else) doesn't shift the responsibility for the increased errors, although it does make them more understandable and acceptable. To me, it's a matter of realizing that sometimes reality sucks, and that includes accepting our part in it regardless of whether we are in a position to make things better.

      (If not, I wonder what kind of projects you work on, and what kind of project manager controls them).

      I'm a self-employed contract-programmer/consultant; sometimes I'm also the (de facto) project manager, and sometimes I'm the QA staff, too. For the most part, all of this is still enjoyable to me, even when it's annoying.... Here's an interesting example of a recent project (company name excluded to protect the guilty), although it i

  62. Another person talks about Mozilla "denial". by Futurepower(R) · · Score: 4, Interesting

    MOD PARENT UP.

    See this +5 comment posted below: Firefox's problem is architectural and not one of garbage collection..

    Quote: Actually I'm pretty sure they're in denial as to the cause of their problems. Announcing they're working on fixing "memory leaks" just supports their ability to continue their delusion. [my emphasis]

    A +4 comment to that comment discusses Firefox's "four separate memory allocation schemes":

    "1. Custom malloc/free implementation. (Yes, custom - not from libc.)
    2. C++ new/delete operators, which for all I know may be overridden to use their malloc/free.
    3. One of the first two with reference counting to decide when to free/delete.
    4. JavaScript mark-and-sweep GC.

    Dealing with this causes some truly insane hacks..."


    Then read the comment they don't want you to see: The memory bug is also a CPU hogging bug. At present, it is marked -1 Flamebait. However, that comment begins to discuss apparent social problems at the Mozilla Foundation, and some of the same material has been marked +5 in the past.

  63. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  64. Re:Why I tolerate it by DogDude · · Score: 0, Troll

    I'm talking about how Firefox still has leaks today (current version, right now). The damn thing has been out for years, and it's about as leaky as a screen door on a submarine. The OSS model is supposed to help make sure things like this don't happen, or if they do, they're less severe. It's been years, and Firefox still leaks memory and crashes like it's still in development (I've had two crashes in the past 3 hours, already). It's as bad or worse than many closed-source projects. In this particular case, OSS hasn't really proven itself to be more effective than closed source.

    --
    I don't respond to AC's.
  65. Re:Why I tolerate it by Paradigm_Complex · · Score: 1

    It's not as user friendly, but you can block ads with the host file. It'll work with any browser, or any program for that matter. http://en.wikipedia.org/wiki/Hosts_file

    --
    "A witty saying proves nothing." - Voltaire
  66. Less than surprising by Anonymous Coward · · Score: 1, Insightful

    Amazing... Last week when the huge gaping security holes in Firefox were discussed, I was heavily modded down for stating that between that and the huge memory leaks in FF, there was absolutely no reason not to just use IE.

    The funny thing was... people claimed I was making stuff up about the memory leaks. I guess this one will get modded down from people denying FF has horrid security. And in next week's FF security article, they will deny the memory leaks. And so it goes.

  67. Re:Why I tolerate it by DogDude · · Score: 0, Redundant

    Duh! I can't believe I never thought of that. That's simple enough. Great idea, thanks! Even better, it's OS-wide, so it effects all traffic coming into the PC. Sweet!

    Oh well, buh-bye Firefox!

    --
    I don't respond to AC's.
  68. Evidence of denial. by Futurepower(R) · · Score: 3, Informative

    "They're not in denial."

    Maybe Mozilla people are not in denial about that one technical issue, but they certainly have been about others. See Mozilla Foundation Top 20 Excuses for Not Fixing Firefox Bugs, posted to the story 611 Defects, 71 Vulnerabilities Found In Firefox.

    Since that Slashdot story, many many memory leaks have been found in Firefox which have made it much more stable. But Firefox is STILL the most unstable program in common use.

    1. Re:Evidence of denial. by Burz · · Score: 1

      I will second that: Firefox 2 is far more stable than 1.5 (on Linux and OS X, don't know about Windows).

      They have done a lot of good work and I consider FF very stable. But they have problems with CPU hogging from time to time. I just experienced a recurrence when Gnome components (and presumably GTK enhancements that affect Firefox) were installed onto my KDE system. Switching away from the default Firefox theme made the symptom go away.

  69. this aint the problem by cinnamon+colbert · · Score: 1

    If I can run ff on my 2001 HP laptop,wiht a messed up harddrive with my own install of Windows 2000 on top of Windows ME, ff performance aint the issue.

    worrying about a little performance is a classic geek mistake; people buy features, not performance.

    what are features ?
    I have poor vision, and Cntrl+ doesnt increase the size of the text in the url window
    the poor state of organization of the site where you down load extensions
    I'm sure all the non geeky /.ers reading this can add other features, like builtin support for video (the videolan thing doesn't work very well)
    Or how about better export and save of urls
    or
    or ....
    remember, people buy features, not performance - if that werent true, how would MS rule the world ?

  70. I don't see this in Seamonkey by Anonymous Coward · · Score: 0

    Really, I don't, on a medium, modest system, 1.5 duron CPU, and up until last month, just half a gig of RAM, went to a whole gig then just because I was putting in a hardware order and a new stick was on sale. I never noticed any big slowdowns or memory hogging, as long as flash was not running. I wonder what the difference is with firefox? I don't use FF so I can't say. I just tried it several times and always went back pretty swiftly to the suite browser (which can be run standalone, you don't need to do the whole suite with email and chat, you can download and install *just* the browser so it is comparable to just the firefox browser). I find the seamonkey browser to render better, load pages faster, and has a much better set of normal preferences (traditional netscape), and various extensions and add ons are avaialble for it as well. Plus, one big URL bar and small search and go buttons, not two cramped tiny URL and Search bars like in FF, that's pretty dumb really and a lame way to use screenestate. I know they both "share" gecko, but there has to be a reason for this discrepancy I am seeing (linux OS, not windows, for accuracy sake). and ya, I load up the tabs and keep it running, frequently might have three dozen tabs open at any one time. So...howcome FF "leaks" for all these people and seamonkey is so much better for me? I am not a coder so can't really look at anything, just reporting my anecdeotal.

  71. Re:Funny you have this problem, I don't by vidarh · · Score: 1
    I've used Firefox since before it reached 1.0, and I've used it on Windows, Linux and MacOS X. On all of them I've had to restart Firefox more than once a day to avoid it from leaking so much memory it'd make the system trash to the point of almost locking up.

    Trying to pretend this isn't a Firefox problem when it's the only application that cause this problem for me and a lot of other people won't work.

  72. Javascript engine Tamarin will use conservative GC by Anonymous Coward · · Score: 0

    Won't the number of memory leaks in Mozilla increase in Mozilla when Tamarin/MMgc is introduced due to the number of false positives? Anyone know why they aren't using a precise garbage collector?

  73. Re:Funny you have this problem, I don't by Anonymous Coward · · Score: 0

    No, he's pretending it's a "Windoze" problem.

  74. Re:You're already tolerating it by using it at all by LindaMack · · Score: 0

    Why is closing your browser daily, a "normal" use? In my experience, the ratio of closers/noclosers is closer to 50/50. Anyway, memory hogging hasn't bugged me that much lately, my firefox sessions are usually open for days without problems (only have adblock and flashblock).
    What bugs me much more is that I can't start a parallel firefox process for opening risky stuff in - you just get another window in the same process, and that one takes the original window down with it when the sh*t hits the fan. I guess the reasons for having it in the same process have mostly to do with it being too much hassle to synchronize multiple processes. Just don't think it's a good reason. If anyone thinks different, please yell - don't downmod :)

  75. Could Linux be the difference? by Herschel+Cohen · · Score: 2, Interesting

    My experience has been quite counter to many of the complaining posts I have read. I now have nearly no lockups that I can ascribe to Firefox 2.0.x whereas it was very obvious that version 1.5 ate memory and at times locked a session. At last count I had 164 tabs open and it is likely nearer to 180 at the moment. At most times I have at least three sessions running email (Thunderbird), browser, coding with Subversion with several files open and in the last a connection to a remote server. If anything my system is much more reliable with 2.0 over 1.5.

    I used to be a casual tester for both versions 1.5 and 2.0 and I switched to each well prior to their offical release. What I noticed was much more effort was expended creating satisfactory working versions on Windows over either the Mac or Linux. Nonetheless, I have been pleased with the results. My use of the coming version 3.0 has been very limited running of most of the stable alpha versions. So far my limited exposure seems to see an improvement over 2.0. Another factor that could make my experience worse, is that I use the Mozilla version that I install by hand. I have long ago not bothered to even update the supplied distribution version. Nonetheless, I have no complaints.

    Another factor that should degrade my experience, is my machine's inners are not of that recent vitage having only one Gig of RAM and a much older AMD CPU. Might some of the problems so vociferously expressed here be due to other factors than so loudly proclaimed?

    I am well aware that supposedly identical machines, with the same software can behave very differently. Had that experience with corporate property using NT and XP, where I could get to Unix and the version control system while a neighbor could not. Nonetheless, I find it odd that my experience is so at odds with the many that have written.

    1. Re:Could Linux be the difference? by Anonymous Coward · · Score: 0

      See I have had a different experience on Linux. Linux is my primary OS, as it has been for the last 15 years, so this is where I have a lot of experience.

      The older Firefox (1.5 and everything before that back to when it was called Phoenix) was very stable. I would run it for weeks at a time without restarting it. Ever since Firefox 2 I have had generally the same problems other people describe. It just gets slower and slower over time and eventually it will just freeze up completely. Usually after just a few hours it gets pretty slow. I can see the effect when I close a tab or go to a new web page. The CPU jumps to 100% and FF just sits there for a minute before opening a new page or whatever. This just gets worse and worse over time until it either freezes completely or I restart it. I'm not running low-end hardware either, my workstation consists of an Opteron 250 with 4 GB of RAM.

      I don't know what happened with 2.0 but I haven't liked it very much. I can't really switch to anything else though because Konqueror sucks for website compatibility and stability while Opera is very unstable too. Plus neither support all the stuff like PKCS#11 modules and things like FireBug which are so useful in Firefox. For example the way Firefox does the find text instantly and without a separate dialog is light years ahead of Konqueror and Opera.

    2. Re:Could Linux be the difference? by cciRRus · · Score: 1

      Refer here.

      --
      w00t
  76. Save typing! Just give the excuse number. by Futurepower(R) · · Score: 2, Informative
    I notice that some of the same old excuses are used here and in the comments to the article linked by the Slashdot article.

    As a community service, I'm posting this list I made. When someone wants to use one of the excuses, they can just give the excuse number. That will save typing.

    Mozilla Foundation Top 20 Excuses for Not Fixing the Firefox Memory and CPU Hogging bugs.
    1. Maybe this bug is fixed in the nightly build. [The same memory and CPU hogging bug has been reported many, many times over a period of five years.]
    2. Yes, this bug exists, but other things are more important. [The bug eventually takes 100% of CPU power, and makes Windows XP unusable, even after Firefox is killed. The bug affects the heaviest users of Firefox.]
    3. Yes, this bug exists, but it is not a common occurrence. [Numerous users have reported the bug. See the links.]
    4. Works for me. [The bug is complicated to reproduce, so the developers did a simplified test, which didn't show the bug.]
    5. No one has posted a TalkBack report. [If they had read the bug report, they would know that there is never a TalkBack report, because the bug crashes TalkBack, too, or a TalkBack report is not generated. TalkBack does not generate a report if Firefox is hogging the CPU. TalkBack cannot generate a report if the bug takes 100% of the CPU time.]
    6. If you would just give us more information, we would fix this bug. [They didn't bother to reproduce the bug using the detailed information provided.]
    7. This bug report is a composite of other bugs, so this bug report is invalid. [The other bugs aren't specified.]
    8. You are using Firefox in a way that would crash any software. [But the same use does not crash any version of Opera.]
    9. I don't like the way you worded your bug report. [So, he didn't read it or think about it.]
    10. You should run a debugger and find what causes this problem yourself. [Then when you have done most of the work, tell us what causes the problem, and we may fix it.]
    11. Many bugs that are filed aren't important to 99.99% of the users.
    12. If you are saying bad things about Mozilla and Firefox, you must be trolling. [They say this even though Firefox and Mozilla instability is beginning to be reported in media such as Information Week. See the links to magazine articles in this Slashdot comment: Firefox is the most unstable program in common use.]
    13. Your problem is probably caused by using extensions. [These are extensions advertised on the Firefox and Mozilla web site, and recommended.]
    14. Your problem is probably caused by a corrupt profile. [The same bug has been reported many times over a period of five years. One of the reports discusses an extensive test in both Linux and Windows that used a completely clean installation of the operating systems, not just a clean profile. The CPU hogging bug and instability was just as severe.]
    15. If you are technically knowledgeable, you can spend several hours (or days) trying to discover the problem: Standard diagnostic - Firefox [mozillazine.org]. [Firefox has "Standard Diagnostics". It has become accepted that some users will have severe problems. !!! ]
    16. I won't actually read the (many) bug reports, but I will give you some complicated technical speculation. [This pretends to be helpful but, on investigation, is shown to have nothing to do with the bugs.
    17. It's understandable that Firefox developers become defensive when users report so many problems.
    18. To spend smart developers' time going over reports of bugs generated by analysis tools would be a waste. [There have been 3 analysis tools recently used to find Firefox bugs, and many have been found: 1) A special tool designed by a Firefox developer. 2) Software by Coverity. 3) Klocwork's K7.]
    19. Your bug report was not specifi
    1. Re:Save typing! Just give the excuse number. by GooberToo · · Score: 0, Troll

      These issues have been reported for years and years now. The fact horrible memory leaks still exist simply underscore how crappy the Firefox coders really are. Putting that into perspective with the fact that Firefox is typically on par or better the IE, really has profound implications for the MS IE developers.

      Wow. I think I just scared my self.

  77. Yes your are... by Luchio · · Score: 1

    Google Talk works in Opera.

    1. Re:Yes your are... by Wolvie+MkM · · Score: 1

      Good to know! Glad it's changed, but now I'm too lazy to switch :D

      --
      I Like Pie...
  78. I've given up on Mozilla. by Ant+P. · · Score: 1

    I've forgiven them time and time again for screwing up.

    First it was the MNG/JNG farce - you have to see this for yourself to believe it. 5 years (!!) of making up bullshit excuses later they dump an inferior, crippled "replacement" format in the browser to force everyone to give up.
    I won't comment on their side project to make a faster, smaller, less bloated browser... you can all see what a success that's been.

    Now for some reason despite all the times the mozilla people have done this -- much more than the two examples I've mentioned -- I was still using Firefox last month. Then it broke spectacularly on me (which was to be expected given it was a CVS build), so I load 2.0 up again and I realise half the extensions I have installed in it are to fix bugs and security holes it shouldn't have in the first place. I can name Noscript and Long Titles off the top of my head. I realised there was no reason to keep using this crap just like there was no reason to keep using windows.

    Memory leaks aren't Firefox's biggest problem -- it's the inmates running the asylum that is. Until that's fixed, I'll be using Konqueror. (if you want to know why I won't use opera, substitute developers for users)

  79. garbage collector in GCC?!? by gd2shoe · · Score: 1

    Excuse my ignorance, but isn't there a huge difference between {removing a frame from the stack && explicit object destruction} and {garbage collection}?

    Garbage collection is usually defined as automatic object destruction when there are no more pointers to it within the application. C++ doesn't do that. It can't, without taking a performance hit and taking control away from the programmer. This is not to say that garbage collection is evil (I use python regularly), only that I seriously doubt your claim to a garbage collector in gcc compiled programs. If there is one, it is probably a different definition than normal for garbage collection.

    --
    I won't join Slashcott. OTOH, If Beta goes live, I just won't be back until it's fixed. Sorry Dice.
    1. Re:garbage collector in GCC?!? by MenTaLguY · · Score: 1

      He isn't saying that gcc-compiled code uses a garbage collector, but rather that the gcc compiler itself (a C program) is implemented using garbage collection (via the boehm garbage collector for C, specifically).

      --

      DNA just wants to be free...
    2. Re:garbage collector in GCC?!? by gd2shoe · · Score: 1

      fascinating. How in the world does it handle an array of pointers?

      http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcdescr.html

      --
      I won't join Slashcott. OTOH, If Beta goes live, I just won't be back until it's fixed. Sorry Dice.
    3. Re:garbage collector in GCC?!? by MenTaLguY · · Score: 1

      Could you elaborate? For a conservative collector, an array of pointers is more or less the most trivial case of a heap object, so I'm not sure I understand the question...

      --

      DNA just wants to be free...
  80. 24 Hours by HTH+NE1 · · Score: 1

    I've found that the Linux version (running in Gnome on RedHat 9) starts consuming ungodly amounts of processor time for minor tasks--even taking 1-2 seconds to respond to buffered keypresses in a slashdot comment textarea--if it has been allowed to run for more than 24 hours. It feels like the same time every day when I have to kill -9 the process and restart it. The only exception seems to be it is able to survive a weekend of non-use. Even vs. odd days?

    --
    Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
  81. Re:Funny you have this problem, I don't by Tim+C · · Score: 1

    Daily reboots are a Windows problem, not FF

    You do realise that he's talking about restarting FF not rebooting Windows, don't you?

    I've got a real clunker of a laptop, 256 MB RAM PIII, that runs FF with Flash and all that

    Congratulations. I regularly see FF hit in excess of 200MB of RAM usage after a few days of normal usage. This instance has been running maybe 20 minutes (after locking up earlier) and is using 65MB already.

  82. First Post! by Psychor · · Score: 1
    First post in Firefox, it took me a while since my machine was running low on RAM!

    Actually at least with the Windows version, I haven't noticed much of a problem with memory leaks personally. I guess that's probably because I finish whatever I'm doing and tend to close all my FF windows at least once every few hours though. Anything to fix bugs and lower resource usage is always a step in the right direction though, so I'd have to applaud this action regardless.

  83. Concurrency and Responsiveness by Chandon+Seldon · · Score: 2, Interesting

    Although Firefox does have some issues with memory usage (and occasionally memory leaks), that doesn't seem the be the primary cause of usability issues.

    In my personal experience with Firefox, I see two problems:

    • The whole browser locks up if a bit of JavaScript is slow - even if it's just one tab being slow out of ten.
    • The whole browser locks up if a plug-in or extension locks up - even if the plug-in is in just one tab out of ten.

    Both of these problems could be solved relatively easily with threads (in a number of different ways), but for some reason the Firefox developers have an irrational paranoia of anything that even vaguely resembles native concurrency. They say "the real problem is just response time, if we can respond fast enough in a single thread it's the same" - but then they never actually do it, and they definitely don't do anything that would let them recover from component crashes.

    --
    -- The act of censorship is always worse than whatever is being censored. Always.
  84. is downgrading a solution? by dropadrop · · Score: 1

    I've really been annoyed by this, but I'm addicted to both adblock and mouse gestures. Would downgrading to firefox 1.x be a solution? I don't even remember if things where better then?

  85. Hoorah! by macdaddy · · Score: 1

    Dare I say, It's about damn time. I've been fighting FireFox memory issues since I first started with Phoenix. Mozilla was never this bad. I rebooted at noon because Firefox was just under 800MB. I've been on the phone and/or away from my desk for 2 of the 4 hours since I rebooted. FireFox is already using 258MB. I love the Fox but this is screwed up.

  86. Less computing power for programmers by Anonymous Coward · · Score: 0

    A lot of problems would be solved if graphics designers were forced to use 15 inch screens and programmers would have to use 500Mhz machines with 256MB memory.

    Unfortunately many programmers and graphics designers have to have the latest machines with the highest specs - the result in many cases are websites and programs which are too slow on lower-end machies.

    That is at least the conclusion I had to draw when I auctioned off the remains of one defunct web design company.

  87. KISS by SuurMyy · · Score: 1

    I cannot help myself but comment the statement where you claim that "Simplest solutions are often the most inefficient ones". I know what you mean, and agree, if the amounts of items you are about to manipulate justify choosing the more complex algorithm. I am taking the sentence somewhat out of context, I am aware of that. And I do apologize for doing so.

    However, in my experience, the opposite, generally, is true. You do know the KISS principle. The most important thing - of course - is to really understand the problem area thoroughly, and choose the Right solution rather than the fanciest. If a fancier solution is not clearly justified over the simpler one, mostly erring to the side of simplicity yields code that is easier to code, understand, maintain - and on the occasion it needs to be done - refactor.

    I would say, from my personal experience, that choosing a solution that fits the problem is very often the simpler rather then the more complex one. Of course, context really settles it, but simplicity is just pure gold, as we're all too bad at programming in the first place. Humans just generally suck at it big time.

    That all said, I do most of my coding in C/C++, but I don't shy away from e.g. Python to use it to do a job that it fits well. However, guestimating, it's probably a bad idea to use a big mix of languages in a big project, unless the areas are very well defined. Also, the problem w/many high-level-libraries is that you become entirely clueless to what's happening under the hood, and that can lead you to do very bad choices. So being a bit picky about what libraries to use can be a good choice, indeed. And in the least getting to know what they do, a bit, too. Of course premature optimization is kind of bad, but then again it most often isn't the simplest way either.

    All in all, I'm a big believer in the KISS principle, and I tend to think that there's a lot of good reason to be that, too. So choose that array over more sophisticated algorithms, if there is no doubt that you won't have many items anyways. Change it to something fancier, when there is reason to, unless you can see from the beginning that there will be loads of items to deal w/.

    Sometimes I feel like people are using more complex algorithms just for the coolness factor. That simply just isn't good design.

    If you're about to code the algorithm yourself, by all means - do that as an exercise - to learn ! - and then toss it, and use the array, to remove all the bugs that your own implementation of a complex algorithm would bring about unnecessarily. :)

    --
    The lyf so short, the craft so long to lerne
  88. I'd like to nominate this whole thread for... by minniger · · Score: 1

    One of the highest ignorance to knowledge ratios in Slashdot's history...

    90%+ of the c/c++ guys have no clue.
    99%+ of those bagging on GC have less of a clue.

    They might as well be talking about girls...

    Geez.

    1. Re:I'd like to nominate this whole thread for... by Anonymous Coward · · Score: 0

      Pretty much.

      It's not 1992 anymore, people...

  89. C++ was broken for Garbage Collection from day 1. by Ungrounded+Lightning · · Score: 2, Insightful

    Perhaps the culprit is C++. Languages with auto-garbage-collection or are database-engine-based tend to clean up automatically or cache to disk more effectively. C/C++ just seems to have so many low-level crevices to accidently mess up with.

    Like C, C++ gives you more than enough rope to hang yourself.

    C++ has four memory models for object instances:
    - Global/static: (permanent one-per-program instances).
    - Stack/locally scoped: (local variables of class type in functions/subroutines or limited scope (between curly-brackets) within them.
    - Member/class scoped: (non-static variables of class type which are members of another class.)
    - Heap/dynamic: (created with "new" and released with "delete")

    The programming model for management of dynamic memory is algorithmic: The programmer is expected to keep track of when objects are no longer reachable and free them.

    C++ provides enough hooks to construct reference-counting smartpointers that can delete dynamic instances when their refcounts go to zero. But reference counting isn't a general solution: A set of mutually-referencing objects can become disconnected. They can no longer be reached and should be freed. But each references another, so their reference counts are non-zero and they persist. This is why garbage collection requires full-blown forest-walks (or incremental partitions of them) to reliably avoid memory leaks.

    Unfortunately, C++ has a subtle bug in the specification (and standards) that prevents building a general garbage collection system within it (even with preprocessor assistance).

    The problem is that garbage collection is one of the ways that an external routine can (properly) call a virtual member function (or do the equivalent) on an object that is midway through its construction or destruction and absolutely must get the correct version of the function for the stage of construction in question.

    This occurs because an object can have pointers to heap-allocated ("dynamic") objects as variables at multiple levels of inheritance. To build in a garbage collector your objects need a way for the collector to identify their pointers and follow them. Anything that allocates memory may provoke it do to this as a side-effect, and routines called during construction (or destruction) may allocate memory, or call something (that calls something that calls something ...) which does so. If this occurs in the base class of a derived class with member variables which are pointers, the latter aren't initialized and contain leftover heap or stack junk. So the garbage collector can go awry and get totally lost.

    To avoid this you build heap-allocated objects (and those which point to them) so that they contain a virtual function that enumerates the pointers in its own level (and those more baseward) and override this as you proceed through the stages of construction, so the pointers at each level are enumerated only IF they have been initialized. (There are constructs other than garbage collection with similar issues, and for some of them the issues are also significant on destruction, as various levels are finalized and their virtual functions would no longer perform correctly.)

    C++ actually gets this correct during the execution of the objects' own constructors and destructors themselves. (Other OOP languages, such as Smalltalk and Objective C, don't. Smalltalk gives you the "subclass" version during the construction of all the levels of "superclasses" - thus breaking the debugging of the superclasses whenever you override a method that is used in a constructor. It gets away with garbage collection because it's built-in and handled separately.)

    Unfortunately, member variables of object type also have construction and destruction, which might provoke garbage collection (or what-have-you) as a side-effect. During the construction of members you're guaranteed to have times when other members are not yet initialized - which ma

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  90. Re:Glad the issue is getting some priority, but .. by aliquis · · Score: 1

    Yeah, I had used opera every now and then earlier but then Ubuntu where retarded enough to stick to firefox 1.0.7 instead of 1.5 even thought it leaked memory as hell I where angry enough of it's 1.5GB of allocated memory so I switched to Opera and haven't and probably never will look back .. Opera after 8.52 rocks.

  91. Just write 4, 12. by Futurepower(R) · · Score: 1

    Those are excuses 4 and 12 below.

    1. Re:Just write 4, 12. by Tim+C · · Score: 1

      Well, I've never had FF crash any of my machines either, but then I've not seen the CPU hogging bug and I don't tend to have more than one window open at once.

      Sometimes "works for me!" is a valid response, as long as you're not the one that's meant to be fixing it...

  92. C++ an inconvenient truth by epine · · Score: 1
    I stumbled across an appropriate quote by Henri Poincaré last night.

    To doubt everything or to believe everything are two equally convenient solutions; both dispense with the necessity of reflection.


    My view of C++ is that it invokes the necessity of reflection more than any other. The people who hate C++ the most are the same people most invested in convenient solutions, for any x, where convenience == x. For almost any x, C++ is terribly inconvenient language. Which is precisely the reaons that C++ excels at solving terribly inconvenient problems, or it would have no reason to exist in the first place.

    Due to the exponential nature of computing power increases, at any given time about one third of the surface area of the problems people are most highly motivated to solve are terribly inconvenient problems: the original open-ended evolution of HTML, the recent transition to Web 2.0, scaling a search engine to 500,000 compute nodes, navigating a Mars rover.

    Resource management has earned a reputation as being a hard problem only because so many people are bad at it. If you can't correctly manage memory in C++, it's pretty much guaranteed you can't write a sychronization correct multithreaded application.

    Most of us have learned to think in terms of preconditions, post-conditions, and invariants for coding a correct iteration that terminates. It's no different to correctly specify object lifetimes in a code base lacking automatic GC. The object comes into existence under this condition, while it exists this invariant is true, when the invariant fails, the object is disposed, and the time between the last two steps is as brief as can be practically arranged (ideally, the distance between two successive program statements).

    I suspect Firefox leaks so much because the coders have descended to mechanistic thinking: to do this task we need to allocate this object, later when this mechanism is activated, if it appears correct to do so, the object is disposed. Sweet. We completely bypassed the inconvenient step of specifying a rigorous object lifetime invariant expression. Hurray! The project will ship on schedule.

    By contrast, the Java programmer is spared any guilt over bypassing this difficult logical step. Only the GC doesn't entirely save you. If by a logical error, you leave a reference to an object intact that is in fact no longer needed, the GC will never free this object. With any luck, the object maintaining this unnecessary reference will get cleaned up later on, and by implication also its orphans. And there won't be much surface evidence of this missed logical step either, aside from the usual observation that the Java app. is generally consuming far more memory than you would like to believe.

    One C++ project I happen to like is the monotone SCM. When you set out to write a rigorous SCM tool, you are committing yourself to a life time of high calorie lunches at the reflection buffet. At this point, C++ is the least of your problems. In fact, I always gravitate toward projects where convenience for its own sake is shuffled out the door on day one. Do you think Google built their massively parallel computational architecture by showing up every day asking themselves first of all "what is most convenient?" No, a challenge on that scale demands a renewed investment in hard thinking after every meal.

    I would learn Haskell for the inconvenience it offers, but I already enjoy 90% of the inconvenience that functional programming has to offer by grappling with C++ template instantiations.

    To paraphrase Einstein--for those of you who find it tedious and inconvenient to wade through a sustained meditation--your programming language should be as convenient as possible, but never more convenient that the problem your program is attempting to solve.

    To update Knuth: premature convenience is the root of all evil.
    1. Re:C++ an inconvenient truth by smellotron · · Score: 1

      If you can't correctly manage memory in C++, it's pretty much guaranteed you can't write a sychronization correct multithreaded application.

      Amen!

      To add to that: If you can't correctly manage memory in C++, you probably can't correctly manage any other resources an average program has to deal with:

      • open file handles (close when you're done)
      • open network connections (close when you're done)
      • database connections (close when you're done) or transactions (always commit or rollback, regardless of exit path)
      • external temporary files (unlink when you're done)
      • external configuration files (more complex, because you need transactional programming: what if your program crashes while you're re-writing the config file?)

      Python and C++ (and probably Perl), make these tasks easy by using deterministic object destruction (RAII FTW!). In Java, this is about the same level of complexity as malloc/new and free/delete, so you're back to square one on resource management.

  93. Re:Why I tolerate it by BenoitRen · · Score: 1

    Your post leaves out some crucial details.

    Yes, Netscape Communicator was closed-source, and yes, its source was released in 1998. However, the released source code was so unmanagable that they rewrote the entire thing. Mozilla (renamed later to Mozilla Application Suite) was born from that. It was an interface based on Gecko, the rendering engine.

    As for Firefox, it's nothing more than an interface fork from the old Mozilla Application Suite.

  94. Not insane. by master_p · · Score: 1

    It's quite easy to do a C++ garbage collector, actually. I've submitted mine to boost (I am not a very competent C++ programmer, but something needs to be done for the memory problems of large C++ applications).

    1. Re:Not insane. by HeroreV · · Score: 2, Informative

      Firefox already has a garbage collector for detecting memory leaks. (It's only used for debugging.) Of course, it probably doesn't help much when JavaScript objects create circular references with C++ XPCOM components, which are reference counted. Those circular references are the main source of memory leaks (or object leaks?) for Firefox. It's very easy to create them, and many extensions are very bad about creating lots of them.

  95. Re:about time! - Firefox on vista? by thealsir · · Score: 1

    I'm not sure if it's Vista, or just Firefox getting better after the 2.0.0.6 branch, but I've noticed GB-sized memory consumption/freezing a lot less on Vista than with previous usage on XP. I think the problem actually is being improved somewhat, regardless of what's really fixing it.

    Regardless, I find the MozFoundation's attitude toward this evasive, given the magnitude of the problem and how long it has been affecting people's machines. I simply find it irresponsible to write unnecissarily resource-gobbling applications, period. Think how much extra power machines are pulling because of this.

    --
    Do not downmod posts "overrated" simply because you disagree with them.
  96. Not really. by master_p · · Score: 1

    It depends on the application. If you have a few large objects, then manual memory management wins. If you have lots of little small objects, a generational copying collector is a much better proposition.

    You should try Java 1.5 sometimes. Allocation of objects is so fast, it's practically equal to using the stack.

    1. Re:Not really. by ClosedSource · · Score: 1

      I don't think allocation is the issue we were discussing, but deallocation. My point is that manual deallocation doesn't require any "discovery" time to figure out which object should be deallocated. It's the delay in deallocation that has the potential of keeping excess memory in play.

    2. Re:Not really. by shutdown+-p+now · · Score: 1
      GP was refererring to deallocation, as well. Due to the nature of compacting GCs, when you have to allocate and then deallocate a lot of small objects at the same time, deallocation is usually a single pointer subtraction followed by update of a few metadata fields (since all objects would occupy continuous area in memory). In contrast, in C++, each call to delete would have to be processed separately. There comes a point at which the cost of tracing all those objects by the GC is lower than the cost of deallocating them one-by-one.

      It should be noted, though, that this pattern (quickly allocating a lot of small objects on the heap) is much more common to Java than to C++, because of the inability to allocate objects on the stack in Java. For those cases where it is needed in C++, one can use a custom arena allocator (though there would still be the cost of having to invoke destructor for each object during deallocation for non-PODs).

    3. Re:Not really. by master_p · · Score: 1

      No, deallocation is a non-issue in garbage-collected systems. Keeping data around is again no problem, because the memory limit for useful data can be manually specified.

      Garbage collection is a win-win proposition for everyone.

    4. Re:Not really. by ClosedSource · · Score: 1

      "Keeping data around is again no problem, because the memory limit for useful data can be manually specified"

      Sorry, I don't get your point. Keeping data around when it's no longer needed seems to be exactly the problem we're discussing.

    5. Re:Not really. by master_p · · Score: 1

      If you don't want data to be kept around, specify a small heap limit, or invoke the collector manually at certain points.

    6. Re:Not really. by ClosedSource · · Score: 1

      So what happens if your application exceeds the limit with data that you still need? That doesn't sound like a very good solution to me.

    7. Re:Not really. by master_p · · Score: 1

      The same thing will happen without garbage collection: the application will die a painful death.

    8. Re:Not really. by ClosedSource · · Score: 1

      The difference is that if a C++ program is well-written, memory may be released sooner, so the peak memory use is potentially less. In other words, there's no such thing as unneeded data hanging around: it's either needed or it's gone.

    9. Re:Not really. by master_p · · Score: 1

      Same thing with garbage collection: data are kept because they are needed or collected because they are not needed.

    10. Re:Not really. by ClosedSource · · Score: 1

      We're going around in circles. Back to the original point: C++ doesn't have to code through a "discovery" process to determine which data is collectable.

    11. Re:Not really. by master_p · · Score: 1

      It depends on the problem at hand: some problems are so complex that humans can't manage manual memory management. In programs with thousands and millions of lines of code, it's impossible for humans to track all memory references. It's also impractical: the real value in programming is to devise a solution for a problem and not having to deal with secondary issues like where does memory come from and where does it go.

  97. could be worse.. by Anonymous Coward · · Score: 0

    If you only have to restart the program, and not your machine, then this may be the single best thing open source has ever done for you.

    Think on it. Read the comments from stories more than 8 years old. Then try ditching windows for something more challenging.

  98. Why slow to fix? Fixing memory leaks is easy by bit01 · · Score: 1

    One frustrating thing about this is that fixing memory leaks is relatively easy. To have any memory leak is unnecessary and a sign of a mediocre programmer.

    To find a memory leak just instrument the memory allocator. See what's left when you exit the program and that's your memory leak.

    There are several commercial/freeware packages that will do this or just roll your own. This will catch all memory leaks that aren't caused by memory corruption, including ones created by threads, addons and interpreted code. You can even use it with a garbage collector to see why certain blocks of memory aren't being freed by the collector. It has an overhead but not a major one and on a fast development machine it's easily usable, particularly if you're able to take advantage of a second CPU.

    The firefox developers should create a beta build with instrumented memory allocation. Better yet make it part of the standard build (it's small) and enable it with a configuration option. The instrumentation could be made quite sophisticated with arena's, snapshots, tagged allocations and the like but even a basic calling PC log would be a big win.

    Memory corruption is a different ballgame. For that you need to do much more sophisticated instrumentation that will catch bounds violations and unallocated pointer access. Possible, but can cause the program to run so much slower that it becomes impractical to do on a large scale. Should still be done occasionally though just to see what obvious, easily fixed violations are occurring.

    ---

    Don't be a programmer-bureaucrat; someone who substitutes marketing buzzwords and software bloat for verifiable improvements.

    1. Re:Why slow to fix? Fixing memory leaks is easy by jesser · · Score: 1

      To find a memory leak just instrument the memory allocator. See what's left when you exit the program and that's your memory leak.

      The hard part is getting a leak reproduced on a developer's machine. If the developer doesn't visit the same sites as you, or doesn't use the same extension as you, he/she might not hit the same leaks.

      Memory corruption is a different ballgame.

      This is why I'm happy that Valgrind is about to be released for Mac.

      --
      The shareholder is always right.
    2. Re:Why slow to fix? Fixing memory leaks is easy by bit01 · · Score: 1

      The hard part is getting a leak reproduced on a developer's machine. If the developer doesn't visit the same sites as you, or doesn't use the same extension as you, he/she might not hit the same leaks.

      Yes and no. If I was a Firefox developer I'd be asking bug reporters to submit screen dumps of the windows Firefox/Help/About Mozilla Firefox, Tools/Addons and History/Show sidebar. That gives an unambiguous and easily created description of the environment that triggers the bug. I would definitely not ask users to manually list environment characteristics as firefox developers are currently asking users to do; users will prioritize the wrong things and often get it wrong anyway. This doesn't include configuration information but should cover the majority of cases.

      However, having said that, there are circumstances where it is hard to reproduce the bug. Memory corruption is one previously mentioned. Another is race conditions caused by the timing of user interaction and/or net etc. Some of these could be caught with timestamps on memory allocation (though a performance hit) but many will not.

      ---

      Keep your options open!

  99. MOD PARENT UP!! by Nicolay77 · · Score: 1

    MOD PARENT UP!!

    This is the most educative post in this entire article.

    --
    We are Turing O-Machines. The Oracle is out there.
  100. Memory leaks by DrYak · · Score: 1

    I've heard that too. I use FF on my desktop at work with one or two plugins (FlashBlock and FireBug, mostly).

    And I've ran Firefox on various SUSE and openSUSE distros, while using a shit load of plugins (Adblock+, Adblock Filterset, Beagle, Dict, Fission, Image Zoom, NoScript, Resurect page, Session manager, Unplug) and browser-plugins (MPlayer, GNUClasspath's Webgcj and Gnash). I've regularly got dozens of opened tabs, of which a significant part is caried over between each sesssion.
    And I've almost never encountered any problem at all (with day long sessions). Really. This on a PIII-generation processor with less than 1GB of ram.
    The only couple of time I encountered something was :
    - A Suse package where they forgot to disable the debug-log feature, quickly fixed with a newer package a few days later.
    - Using unstable alpha Gnome package sometimes crash on opening certain dialogs. As soon as a I replaced with stable Gnome. Everything was back to normal.

    Though, the last few time I tried installing the Easy Gesture plugins (a radial menu gizmo) memory usage completely crapped out. Back to normal by removing the plugin. Thus I'm actually ready to believe that memory hogs are due to some badly behaving plugins. That explains why only some people experience them : only the users with the bad combination of plug-ins have problems.

    Also, note that mplayer, webgcj and gnash browser plugins, aren't actually plugins, but thin wrappers that launch player in separate process and integrate the output inside the webpage (just like the mozplugger did back then).
    Other browser plugins that are dynamic libraries and thus run inside the same process as firefox. If ".so / .DLL" plugin eats up memory, the memory is allocated for the firefox process. Once the plugin is finished, its memory stays allocated (because the allocator application - Firefox - isn't closed yet).
    Gnash and MPlayer are separate process. They allocate their own memory and once they finish, the process is closed and everything allocated by it is freed.

    I've observed that some flash pages make Gnash process go mad. Hopefully as it's a separate process, it's easy to kill. But means that, had it not been a separated process, it would have been Firefox that would eat 1GB virtual memory). In fact the few couple of time I've tried installing the Macromedia Flash browser plugin, I've experienced massive instabilities (FF freezing when closing tabs and such). Even now when I use the stand-alone player, very often is freezes or jumps its memory usage. Adobe Acrobat was another browser plugins that doesn't behave well (I've never attempted installing it, I've seen enough horror stories on friends' computers).

    Thus most memory leaks could be blame to some plugins and very probably to badly behaving closed source browser plugins that run as dynamic libraries in the same process.
    That, or there some mysterious anomaly that causes opensuse's firefox packages to behave differently as the rest of firefox installations on other machine.

    That said, if a plugin leaks memory, there are a few options. First, the system should know. Even if the plugin in used constantly, I should be able to open the extensions options panel and see how much memory each one is using, so I can identify the culprit.

    Saddly that's not technically possible. At least not in a easy way. Because most plugins, both Firefox extensions and browser plugins, run in the same process as Firefox it self. All memory gets allocated by the same process : "firefox-bin".
    To be able to distinguish between memory allocated by firefox' core and plugins, what is needed is complex system that uses hooks into the malloc/free procedures (just like valgrind and similar memory debugging tools) and also some kind of "context" variable that gets changed before jumping into and after returning from code in plugins, so the hooked malloc/free can guess whose is the code that allocated

    --
    "Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
  101. Flash by DrYak · · Score: 1

    and my wife's machine (honey, what's a plugin?)


    I bet that she has no firefox extension plugins (the thing that goes inside extension manager), but that she has both adobe/macromedi flash and sun java (and eventually adobe acrobat and realone player) browser plugins installed (the things that go insed about:plugins).

    Those are piece of code that plug inside firefox main process too. In fact they are worse because they are dynamic libraries (.dll / .so / etc), that plug into firefox at the binary code level (as opposed to extensions plugins which are additionnal script the got execude *inside* the single threaded javascript interpreter).
    --
    "Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
  102. It's FLASH not Firefox by Anonymous Coward · · Score: 0

    Seriously. Install flashblock. I was absolutely amazed at how little memory and incredibly stability came out of just "not having every stupid flash ad run". Flashblock lets you selectively run the content you want, and nothing else. While I know Firefox isn't perfect I'm pretty sure 90% of people's complaints about Firefox hogging memory and crashing and becoming unresponsive is actually due to Flash leaking back into the Firefox application.

  103. Well, at least there's a new marketing angle... by suitepotato · · Score: 1

    ...towards older men. "Mozilla Firefox. The only browser with more leaks than you with that bad prostate."

    --
    If my grammar and spelling are off, I am [distracted/tired/careless] (take your pick)
  104. Re:Memory leaks by MBCook · · Score: 1

    I run FF on Windows at work. It's not a problem for a day or so (which is quite common for me) but after two or three days it will be using a ton. Just making sure I close all windows once in a while fixes all that.

    For everything running under firefox-bin... hooking malloc is exactly what I'd suggest. If they are written in something like JavaScript it shouldn't be that hard to tag allocations. If they are written native then scan them for malloc calls and such and refuse to load. They should call ffmalloc (or whatever you want to call it) and it's (new) friends. That would make keeping track of it rather easy.

    I'm not saying this is perfect. I'm not saying it's the world's cleanest idea. But it would give a good idea of what was going on. Using a separate thread for each thing would improve things, but that has tons of problems (especially synchronization, unless you run everything serially one thread chaining to the next, but that's quite hideous).

    As for the "when X is doing Y" thing... that's near impossible. With the above in the developer should be able to put some sane warnings on it, but that was mostly a little "think is how I think things should behave" bit, not really something to implement. It was going to be that kind of suggestion, but it got nearly impossible fast.

    I've heard the new JS/EMCA engine that they are working on should fix some of that stuff, but that is quite a ways off.

    It's OK. Firefox is a great browser. I love Safari on my Mac, but on Windows I'm hooked on FF. Safari is nice, but since Apple loves to re-implement everything it isn't the fastest horse in town. IE is... well... the browser just got tabs last year. It's really hard to debug CSS type issues, and I frankly thing 7 is just plain ugly.

    --
    Comment forecast: Bits of genius surrounded by a sea of mediocrity.
  105. Kestrel by Nicolay77 · · Score: 1

    There's Opera 9.23 stable and there's Opera 9.5 Beta (codename Kestrel).

    Even as Opera is known to be fast and use little memory, Opera 9.5 is faster and uses even less memory, being the best browser I have ever used.

    I also use Safari sometimes (to have two gmail accounts open, for example) and I'm in windows. There's no reason to use IE at all.

    However, it's still a beta, YMMV, etc.

    --
    We are Turing O-Machines. The Oracle is out there.
  106. Debugging programs by Anonymous Coward · · Score: 0

    After reading a fair number of comments, it seems that upwards of 80% of the posts are by people saying "it's not a problem" or "it's a big problem." Another 10% or so seem to be "dude, it's not as easy as you make it sound." There are only a few posts which actually sit down and explain why this can happen.

    A small problem with coding is that, these days, the primary first programming language tends to be Java, which shields most novices from the concepts of pointers or memory management. After going into more advanced programming courses involving C (and later x86 assembly), the majority of people hit the wall of comprehending pointers. Our teacher essentially said to not worry about freeing memory--the programs were trivial and the resulting memory leak would be minimal. These same developers later go on and start working on production-level code and start failing to clean up memory--or worse, clean it up haphazardly and dangerously. It takes a fair amount of keeping track of code to actually be able to achieve zero memory leaks (I would be willing to bet that there are several leaks in the Linux kernel).

    At this point, I would also like to interject with my experience with Mozilla. I have not worked on FF--the core build library of FF would kill my computer, but I have worked on TB and the calendar portion. My experience with the code is that it needs nothing more than a massive steamroller to destroy the TB portion of the code and rebuild from scratch: it is an export of the old Netscape code built upon with hack after hack and of very poor documentation: TB is very often overshadowed and ignored with respect to FF. The calendar project is even worse: the main cabal there seems to push it to be more and more like Outlook when it is currently in several ways superior.

    I would also like to make comments about other points brought up:
    1. It is nearly trivial to create a memory leak in Java or with any other modern-day state-of-the-art garbage-collected programming language: just hold on to an object longer than you need to. It is the nature of most instruction that I have seen to actually implicitly encourage this tactic; these memory leaks are more difficult to track down than objects that merely haven't been freed since the reaction tends to be "I might need it later."
    2. Multithreading is not the panacea. Try coding serious multithreaded code for a minute and see how well that works. Multithreading GUIs (besides a thread for rendering and maybe a thread for double-buffering and the main thread) is almost an exercise in futility: too many components are interacting and holding each other up. It was pointed out that one thread could be rendering each tab--that is going to be of dubious efficiency since more than two threads is pointless (current tab and background; I don't see quad-cores in the near future and the overhead of context switching can make large number of tabs unusable). Another reason that it could be a bad idea is that having two threads IO on a local disk at the same time is going to increase run time (local IO being one of the best examples of where your CPU is sitting idle; remote IO is even better at that!)

    I have many more, but it is getting late, so I think I will end here for now.

  107. Microsoft Marketing is scarier than horror movies. by Futurepower(R) · · Score: 1

    "Wow. I think I just scared my self."

    The REALLY scary thing at Microsoft is to get to know some "Marketing" people. Hollywood's horror movies are a laugh compared to the horror of at least some of Microsoft Marketing.

    I've met Microsoft Marketing people who are zombies, who don't actually contribute anything to Microsoft, but to continue to get paid they have to pretend they do. Every day they wake up and pretend to have a job. And Microsoft pretends that they are useful.

    It's that sneaky insanity that is scariest.

  108. Games shouldn't need more than 5 MB by tepples · · Score: 1

    'm willing to let game developers slide on being memory hogs by virtue of the fact that modern games require modern computers, games are driven by tight performance requirements, and there's generally little multitasking with other applications when gaming. Then why can't PC games be cranked down in detail to require only 5 MB of RAM? That's about how much RAM the Nintendo DS handheld video game system has.
    1. Re:Games shouldn't need more than 5 MB by Rei · · Score: 1

      Hey, if people were willing to accept DS-quality games... ;)

      --
      Ever since, I've been suspicious of Jesus and very careful around chlorine.
  109. Hahahaha! by Anonymous Coward · · Score: 0

    That's funny, one the people who repliead to your post about the 20 excuses is actually guilty of using many of them.

  110. There is no major memory leak by Enderandrew · · Score: 1

    This issue always comes up, and it seems the vast majority of the people in this thread are bashing Firefox/Mozilla, but they are ignoring three very crucial points.

    1 - The code already has been tested with garbage collectors, Valgrind and the like. Most memory leaks hopefully have already been caught, but they are recommitting themselves to this task.
    2 - Mozilla is not responsible for the poor javascript and such prevalent in various extensions written by third parties.
    3 - This is the most important part, the massive memory and CPU usage is a feature, not a bug, and can quickly be disabled. Firefox 2 and 3 cache fully rendered versions of pages, so that it is "quicker" when you hit the back button. It doesn't have to rerender the page. Personally, I don't care for this feature, and so I tell Firefox to use less memory.

    http://kb.mozillazine.org/Memory_Leak

    Google is a powerful tool. Slashdot readers should familiarize themselves with it before crucifying Mozilla.

    --
    http://blindscribblings.com - Tasty pop-culture in conceptual fashion.
  111. startup performance by Anonymous Coward · · Score: 0

    Good! Now they only have to tackle the startup performance of this beast, and perhaps some day firefox will become the truly lightweight browser it was intended to be since v1.0.

  112. Video games? by tepples · · Score: 1

    Not great for programmer productivity or indeed programmer work satisfaction when you have to relearn all the fundamentals of programming "to the metal" every 5 years. Yet the interactive entertainment industry puts up with this.
  113. Set affinity by Z80xxc! · · Score: 0

    There is a somewhat simple solution for those who have multi-core processors. Limit Firefox to only one of your cores. No matter how much (of that) CPU it uses, Windows itself can still use the other. You could even set Explorer.exe to use only the other core(s), to completely isolate the two. Yes, I realize explorer is not all of windows, but it seems that affinity can't be set on winlogon and other system tasks. :-( This doesn't solve the RAM problem, but it could help with the CPU issue. Also, it's worth noting that Firefox is only using about 100 megabytes of RAM right now for me, by far the most of anything I have open, but nowhere near the 400 megs or so some people have reported.

  114. Mod Squad - Re:C++ long-in-the-tooth? by Tablizer · · Score: 1

    Holy cow did I learn something from my post that started all this controversy: C/C++ is popular with those who have a lot of mod weight on /. and they are not afraid to use it if you criticize their favorite tool.

  115. Performance, performance, performance, performance by AbRASiON · · Score: 1

    (throws chair!)

    In all seriousness though, I want performance from FF, feature wise the latest stable 2.0 releases with the addons I've installed (about 6 iirc) is more than enough for my _current_ needs.
    I want to see this application pick up in speed, a lot.
    Sure it's fast now but goddamnit people I (you?) want more - I've got 4gb of ram, I've got dual core processors, I've got fast hard disks but still the web isn't fast enough.

    I'm not a developer, I'm an enthusiast, take my posts with as much salt as you like but I've found the speed of opening web pages hasn't particularly improved that much in the past 10 years.

    Sure the pages are more complex, no denying it, I'm not completely dopey.
    We used to open what? 50kb of html / images on dialup 10 years back, now how big is your average page, (I honestly don't know) but based on my bandwidth use, quantity of pages I hit, I think it would surely have to be under 500kb.

    See the thing is, I don't find the cache use in any browser clever enough, it just doesn't seem to get hit enough at least that's what I'd theorise.

    While I'm at it, the one thing I've found which increased performance massively for me was a small application called 'easy dns' - I believe it's no longer available and either way I can't install it on every machine I browse on, but it was a DNS caching tool, lets you add up to 10 DNS servers, it would chose the best ones AND cache whatever ones it had already opened.
    When your browser hits /banner.jpg then /sidebar.jpg then /bottom.jpg etc - these hits seemed to be faster, perhaps it's time for something like this to be built into a browser?

    This may come across like a big whine but honestly, I think FF is fantastic, the features are rich and it works well but hell, let's keep improving, I'd love to see the web truely, amazingly quick.

    While I'm on that note, perhaps some performance tips for FF would be in order, anyone got any?

  116. Re:no way around it by talledega500 · · Score: 1

    Unfortunately, as talented as the team is, there are limits to the architecture.

    There is no such thing as an accurate C++ garbage collector and anyone that says they can write a huge app in C++ and not have a memory leak is just an arrogant ass. Once you mix in Javascript forget it altogether.

    Interestingly, this is not only due to the talent of the team in writing C++, but due to the desire to port this thing across platforms.
    As slow as it may be compared to C++, Java itself would be a sensible solution, given that the ugly hacks would at least
    have some portability and an accurate garbage collector to rely on.

    Its called diminishing returns, and every line of code added to Firefox diminishes the returns even more.
    Has anyone remarked that these CPU and memory issues have been going on since Netscape?

    Firefox was not always so rife this problem. Lately though it does seem to be getting worse.

  117. Re:C++ long-in-the-tooth? OMG by talledega500 · · Score: 1

    What C++ moderator gave that a 5?

    There is not a single object in a single OO program that can possibly have the correct responsibility for freeing its memory
    EXCEPT a garbage collector.

    Its nonsense like this which is why any sizable C++ production app will take years to work out its "memory leaks".
    And thats the best C++ coders around writing those apps.

    So you explain if you want to go off on such a tangent, exactly how an OBJECT or a CLASS knows when all its consumer objects are done with it?
    Reference counting at the app level? Almost all C++ apps have some feature like this. And they ALL have memory leaks.

    You are up a computer science creek with no paddle my friend. You havent addressed long lived and short lived objects,
    Objects exposed by API which have no "open" and "cleanup" methods, transactions, statics, you are just a fool.

    And any app you wrote or anyone else ever did in C++ has memory leaks.

    Period end of story. Moderators, Please stop ranking C++ purists as insightful when they are spouting on about technological impossibilities.
    Large C++ apps ALL have memory leaks. Its a mathematical certainty not a statistic regarding bad coding practices. And there is no solution but an accurate garbage collector which is a technological wonder in and of itself. Java has one.

    The only difference between Java programmers and C++ programmers in this issue is that java programmers have THE GOOD SENSE to know they cant and shouldnt bother to write garbage collection routines when they write an app. Especially since computer science has only come up with a few ways to do it by smarter people than them with alot more time on their hands.

  118. How about fixing the broken contextual menu in OSX by Chris+Tucker · · Score: 1

    In 1.5, leftclick and hold brings up the contextual menu.

    In 2.0 and up, you HAVE to hold down a key on the keyboard and right click.

    And there is NO preferences option to change it back.

    What dipwad thought THAT was a good idea?

    Fix the broken usabilty/human interface bits, as well as the memory leaks and then maybe you'll have a decent browser once again.

    In the meantime, I'm sticking with 1.5. The FireFox browser that's not broken.

    --
    Guaranteed! This comment 100% Anthrax free!
  119. Re:Javascript engine Tamarin will use conservative by QuoteMstr · · Score: 1

    Conservative GC scares the hell out of me too, but it *seems* to work well enough in practice. Still makes me nervous. The Boehm GC leaks like crazy, but something that's mostly-precise, like SBCL's garbage collector, seems to do okay.

    Oh, and the linked article seems wrong; SBCL's GC is both conservative and generational.

  120. Re:You're already tolerating it by using it at all by Anonymous Coward · · Score: 0

    A poor workaround for this problem is to create another profile for your risky visits. See the "-P" and "-ProfileMAnager" options to firefox. Each profile will run in a separate process.

    Or you could create a second user for running another firefox even more safely.

  121. "Opera is not a viable alternative"? Bullshit... by WIAKywbfatw · · Score: 1

    ...in the Windows World, Opera is not a viable alternative to many people who find the Opera UI to be excessively daunting for casual use.
    Sorry, but that's pure bullshit, and I suspect that you know it.

    I use Opera on Windows. The UI is pretty damn customisable, and within minutes you can have it doing exactly what you want.

    Skins can be downloaded and installed in seconds. And I mean seconds. The main toolbar, the address bar, status bar, etc are all customisable, and you can add, remove and tinker with them and their elements very easily.

    Getting a UI that you're not only happy with but that also feels more intuitive to you and that makes you more productive in the long run is very quick and easy to do.

    'Out of the box', Opera's default UI is very usable. With a few simple clicks via the installation wizards it can be made more so. And, of course, with a few more minutes spent adjusting things it can be made to feel very personalised.

    To be honest, I find it a rather hypocritical (and hilarious) complaint for a Firefox user to make, given that the typical Firefox user will do far more of the same (install, skin, tweak, customise), and on top of that will spend far more of time downloading, installing and customising add-ons, many of which purely play catch-up to core Opera features.

    The idea that Opera 'out of the box' is "excessively duanting" compared to Firefox 'out of the box' for casual users is just the funniest thing I've heard in a long time.
    --

    "Accept that some days you are the pigeon, and some days you are the statue." - David Brent, Wernham Hogg
  122. Would this help? by FoamingToad · · Score: 1

    You could use AT to schedule a "shutdown -f -r -t 5" once a day, at (e.g.) 01:00 - assuming you're auto-logging in to a session, and your software is set to autostart afterwards.

    F_T

  123. Re:Performance, performance, performance, performa by k8to · · Score: 1

    Browser caches suck, you're right.

    I set up a cacheing proxy (squid) and it's the single biggest improvment to my browsing experience ever. I give it around 6 gigabytes (powers of 2) to play with, in a combination of the file stores and the experimental newer object store (for the bigger crap), and tweaked the expiration times to meet my single-user needs (keep the data for weeks folks). Pages just come up kablam.

    The huge number of incidental stupid little bitmaps on sites are all a local socket away.

    What's interesting is to look at the performance characterstics of copying 300kb - a few megs of graphics over a local socket vs mmapping it in or whatever. It's a nontrivial additional amount of time to do all those memcpys and context switches. But it beats the HELL out of any browser cache. I don't understand why the browser people can't, in the worst case, just use the guts of a decent http caching proxy. Some of them are open source guys!

    --
    -josh
  124. Not just you by gidds · · Score: 1
    Yep, similar experiences here.

    Admittedly, I don't stress it on this 'ere XP box as much as I do on my G5 at home, where my norm is probably four or five windows holding anything up to 50 or 60 tabs between them, and I leave it running all the time. (Or at least, as long as I can until it gets unbearable and I have to take my life in my hands and hope that it doesn't forget all my tabs when I restart!)

    What's most annoying with the Mac version, though, is the lack of responsiveness. I don't mind it taking ten seconds or so to open a page; well, I do, but it'd be very bearable if it didn't also completely freeze the GUI for the first half of that, and then react very slowly and jerkily for the rest.

    I can't say I like XP, but there at least Firefox is relatively responsive when it's busy. Having the Mac OS X version beachball whenever it does anything is most annoying.

    Oh, and while we're talking of Mac Firefox woes, does anyone else find that it won't show Flash unless it doesn't fit on screen? If I scroll down so that the the Flash area goes off the top, even just by a pixel, then it appears fine; but if the whole of the Flash area is visible then it won't redraw properly; often it's completely blank. Could this be a plugin issue, or am I doing something wrong?

    --

    Ceterum censeo subscriptionem esse delendam.

  125. and how will they find the source of the leaks? by Anonymous Coward · · Score: 0

    Sure, it's easy to load an extension and see "omfg my developer machine is halting to a crawl!?"... But how do you find the source of the leak? I'm honestly asking. In the (I know, I know, it sucks) Java world, I can use nowadays very spiffy profilers. They're not only cute as pink ponnies but they also have options like Find probable culprits for memory leaks, they can be remotely attached (say from another machine on the network, convenient to profile server-side apps runnin on headless systems) and detached from running apps with barely noticeable effect on performance (and the profiling options are only getting better and better with every Java release).

    And don't think I didn't spend hours tracking leaks in C or x86 and 680x0 assembly programs. It's just that I'm wondering if those people are not actually wasting lloottss of time using tools that can't compete with what's available today when you use some other technologies.

    When was the last time I could remotely connect to a running C app and have many shiny profiling infos appearing instantly? I'm honestly asking... Because when I read TFA and TFS ('S' = "summary") my first thought is: middle age. Honestly.

    But I hear ya, Java sucks, the JVM sucks, it can't scale, etc. That's why small companies like FedEx and Google are not using such crap for their most demanding web server and.. Oh, wait!?

  126. Re:Funny you have this problem, I don't by Anonymous Coward · · Score: 0

    It's not 1998 anymore, Windows does not need daily reboots. If you don't know what you're talking about, kindly shut the fuck up.

  127. it was about time by diego.viola · · Score: 1

    I'm using the latest build of Firefox 3 (gran paradiso) on Linux right now and it doesn't crash or gets slow anymore like Firefox 2 did when I had more than 20+ tabs open, this version of Gecko also passes the Acid2 test, Firefox 3 will be a great release. Thanks Mozilla developers for all this ;)

  128. What the hell are you people doing? by aliens · · Score: 1

    I'm just curious what exactly everyone is doing (on Windows I understand Firefox has different problems on Mac) that causes Firefox's memory usage to be a problem on a modern box.

    I have a gig of RAM, 256 of which goes right to a VMware instance, run Outlook all day long, usually have photoshop open, and work with Firefox all day long. Multiple tabs, plenty of fun little extensions, Flash, the whole package.

    So what clues you into Firefox's memory usage? Does your system start running slowly? Or are you opening Task Manager seeing Firefox is using 200megs and getting angry?

    Maybe I have better luck because I shutdown nightly.

    --
    -- taking over the world, we are.
  129. Memory leaks are a sign of bad management by CodeShark · · Score: 1
    Interestingly enough, I was once part of a development team that created a competing WFC GUI library that had no known memory leaks under the four existing "wintel" platforms of the day Win 3.11, WFW, Win95 and WinNT (3.5X), and had begun porting to other chipsets and platforms. Unfortunately, the marketroids decided to spend a bunch of the remaining dev budget to try and get some serious venture capital and IPO the darn thing rather than "release early release often, and the whole effort went up in $$$ flames, AKA the company went out of business shortly thereafter.

    So when a company or group of coders say they can't fix their memory bugs, I say bull----. When they say that the parent company doesn't pay for fixed code, that I believe.

    So if ten years after a small team of four had a bug and memory-leak free code stack, the fact a browser still leaks like a stuck pig after the hundreds of thousands of hours of code that went into Firefox, then it's obvious where the fault lies.

    Especially because if they prioritized that fix, coders like me might actually be interested in contributing again.

    --
    ...Open Source isn't the only answer -- but it's almost always a better value than the alternatives...
  130. The problem seems to be a social one. by Futurepower(R) · · Score: 1

    "Sometimes "works for me!" is a valid response..."

    I definitely agree that "works for me" can be a valid response. In the case of the Firefox CPU hogging and memory gobbling bug, however, Mozilla developers are routinely saying "works for me" without duplicating the conditions under which Firefox fails, or even reading the reports carefully.

    Why? I don't know, but I have theories. The politics inside Mozilla Foundation, which now takes in $50 million each year because of making Google the default search engine, seems to somehow favor those who work on the easier bugs to fix. This makes sense, since the chief of Mozilla is a woman with no knowledge or interest in technical things. (See my earlier comment for links.) There can be no effective supervision because the top executive cannot understand even the simplest social issues surrounding Mozilla Foundation software development.

    There is a huge variation in Firefox use between users. Most users apparently finish with one issue before they go to the next. Some, however, are extremely heavy users. For example, a computer parts buyer for a corporation that builds computers may need to keep an issue open until he or she gets from answers somewhere else. It is those users, who keep many windows and tabs open for days, with numerous hibernations, who experience the worst memory gobbling and CPU hogging.

    There are other contributing factors. People who work especially fast seem to have more problems. Those who have more than one Mozilla program open, for example Thunderbird and Firefox, sometimes see that the CPU hogging bug is shared between Mozilla programs, so that, as many windows and tabs are open in Firefox, Thunderbird begins hogging the CPU! And that tends to corrupt Windows XP; although Windows XP will still operate somewhat after all Mozilla programs are closed, some OS operations will be quirky or inoperative. The only way I've found to return to normal Windows XP operation is to re-start the computer.

    As I type this, Firefox is using up to 29 percent of the CPU, sometimes peaking at over 60, with no Firefox activity, since I am typing into an editor. So, later I face the need to close all my Firefox windows and tabs, even though I am not finished with some issues.

  131. Re:C++ long-in-the-tooth? OMG by TemporalBeing · · Score: 1

    There is not a single object in a single OO program that can possibly have the correct responsibility for freeing its memory EXCEPT a garbage collector.
    Dead wrong. It's all a matter of design. If you design a class to handle buffers and assign that class to the responsibility of handing out buffers to objects - which can then be passed around in accordance with the software design - and when done, be passed back to that class then that class can in fact know which buffers are in use and which are not. And in fact, if it has any that are not returned to it, that is a memory leak but a memory leak that can be handled - the buffers can be tracked. However, you have to do proper engineering of the software. You as a computer scientist may not like that, but the reality is that properly engineered software is in fact very solid - regardless of the language you use. But you have to do the work to get it there. If you're not willing to do the work, then don't complain when your application crashes and you can't figure out why.

    And any app you wrote or anyone else ever did in C++ has memory leaks.
    Hmm...there are quite a few C++ applications out there that do not have memory leaks. And yes - I have written C++ applications with no memory leaks - and provably so. But I have also gone through the work to design it to be so. It's not hard - just takes time, and is not something a code monkey can do. Sadly, this is not something taught in Computer Science - they just tell you go and do it, they don't really teach you how, and they completely leave out the engineering side of software programming. Most students are lucky to get a semester in an abbreviated software engineering course. However, software engineering is really what is required by industry to deliver good software.
    --
    Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
  132. Re:How about fixing the broken contextual menu in by Anonymous Coward · · Score: 0

    Actually, there is a preference.

  133. No programmer should have to worry about garbage c by mcvos · · Score: 1

    No professional computer programmer should be incapable of programming without automatic garbage collection,

    No professional computer programmer should have to worry about garbage collection. This can be automated, which means it should. Not doing so means that sooner or later, you'll end up with memory leaks.

    just as no aeroplane pilot should be incapable of flying without an autopilot. You shouldn't be doing it very often, but you absolutely should have the ability.

    You should understand what it's about, but that doesn't mean you have to do it all by hand. Programming without some smart garbage collection system is like flying an aeroplane and refusing to use the autopilot. It's asking for trouble.

  134. Well... no. It wouldn't go away by Anonymous Coward · · Score: 0

    Memory allocated to a program is not released until the program terminates. Unused memory gets swapped out to disk if needed, but still counts in things like ps and top.

  135. Re:No programmer should have to worry about garbag by m50d · · Score: 1
    No professional computer programmer should have to worry about garbage collection. This can be automated, which means it should. Not doing so means that sooner or later, you'll end up with memory leaks.

    Garbage collectors are imperfect and consume resources; there are times when it's better to avoid them. Just as there are times, few and far between, but they do exist, where writing it in assembly is the right thing to do. Certainly writing the whole of a web browser in a language without garbage collection is an exercise in stupidity - things like the bookmark manager don't need performance (except possibly in the actual drawing, but they're using a library for that, or should be), but I would find it entirely plausible that the core of the rendering engine is best done in C.

    --
    I am trolling
  136. iFox Smooth theme with the Windows version by Futurepower(R) · · Score: 1

    I will soon try the iFox Smooth theme with the Windows version of Firefox.

  137. It prints money by tepples · · Score: 1

    Hey, if people were willing to accept DS-quality games... ;) If DS-quality games are good enough to print money, then why can't PC games be scaled back to DS-quality graphics? Heck, I'd bet GBA-quality graphics can be done inside a Firefox window with only DHTML, no Flash.
  138. MOD PARENT DOWN by slyborg · · Score: 1

    Wow. HTF did this get mod points?? Guys says straight up he's talking out of his ass, and it gets Insightful??

    1) Mac user. WTF was that tacked on comment at the end for? reality check : Mac users know what's up, which is why they use Macs. I know perfectly well what happens when I close a window.

    2) And news for you, when you close a window on any platform, it releases the object resources held by that part of the application, whether or not you quit the application. And on Windows, quitting IE by closing a window also doesn't take IE out of memory, Windows caches it to make IE's startup look fast.

    3) It's as valid to say that many people don't realize that if they push the power button on the computer, it doesn't actually turn it off. On many laptops, this invokes Standby or Hibernate, which doesn't clean anything up in memory.

    4) My wife works in a bank. Nobody, and I mean nobody, turns off a computer. They log out, and there the computer sits, running Windows. So your "general users" are apparently "general users who turn their computers off at the end of the day"; who, I agree, most likely turn their computer off at the end of the day.

    So on-topic, I do work in the tech industry, usually have my OS X laptop at around two weeks of uptime, and happily run Firefox 2 with a NoScript and AdBlock for days on end with no crashes. It does leak, and when I decide the system needs the memory I restart, which is the work of all of maybe 15 seconds.

  139. Re:C++ long-in-the-tooth? OMG by talledega500 · · Score: 1

    Yes you can ALWAYS collect the trash when you know exactly how things are consumed and you have ALOT of time on your hands.

    Thats called application or API specific garbage collection. The reason it doesnt work
    is that any decent OO program will not be concerned with tracking client usage
    because object lifetime is largely out of the scope of OO programming...in its ideal state.

    So for A PARTICULAR application sure you can CLEAN UP the memory leaks.
    But once you use those objects again in a different context, the leaks will be different,
    so you will have to write DIFFERENT application specific garbage collection.

    Thats why you are better off not doing it at all. In java for example, do you know what the biggest resource issues are?
    NATIVE CODE, database connections and the like.

    Of course they can be cleaned up. But its native code forcing all that to happen because native code must concern itself
    with all these irrelevant things. Having an Object called a garbage collector that deals with it is the most OO thing
    you could think of.

    Anything that doesnt use one is simply not OO. As evidence of what Im saying, point to any new or recent languages
    that DO NOT have some form of garbage collector. malloc and free are history man.

  140. Would have modded you up if I could :-) by SplatMan_DK · · Score: 1

    Would have modded you up if I could :-)

    I did not attend the conference in question. My only trip to the US was to Denver this summer, where I attended the MS WPC. :-)

    If you have a name or two I can do a LinkedIn search?

    I'll throw you a mail with the same answer :-)

    - Jesper

    --
    My security clearance is so high I have to kill myself if I remember I have it...