Slashdot Mirror


Firefox Javascript Engine Becomes Single Threaded

An anonymous reader writes with news about work on Mozilla's Javascript engine. Quoting Mozilla engineer Luke Wagner's blog: "With web workers in separate runtimes, there were no significant multi-threaded runtime uses remaining. Furthermore, to achieve single-threaded compartments, the platform features that allowed JS to easily ship a closure off to another thread had been removed since closures fundamentally carry with them a reference to their original enclosing scope. Even non-Mozilla SpiderMonkey embeddings had reportedly experienced problems that pushed them toward a similar shared-nothing design. Thus, there was little reason to maintain the non-trivial complexity caused by multi-threading support. There are a lot of things that 'would be nice' but what pushed us over the edge is that a single-threaded runtime allows us to hoist a lot data currently stored per-compartment into the runtime. This provides immediate memory savings."

59 of 346 comments (clear)

  1. You had me at.. by Sez+Zero · · Score: 5, Funny

    "memory savings".

    1. Re:You had me at.. by Anonymous Coward · · Score: 5, Funny

      There's a reason they're the most efficient browser when it comes down to memory usage. They actively work at it.

    2. Re:You had me at.. by hedwards · · Score: 5, Informative

      Which is why they always cream the competition in the benchmarks? Seriously, the only time I've ever seen it waste memory was during a session where Silverlight crashed. In general it tends to use very little in the way of memory.

      OTOH, given your post, I can only assume that you're using lynx, tons of extensions or are some sort of troll.

    3. Re:You had me at.. by jellomizer · · Score: 4, Informative

      However memory usage is one of those moot points.
      Often (Not all the time) you come to a trade off of performance vs memory usage.
      Sometimes it is better to store a bunch of data in memory just for quick reference then having to calculate it over and over again or worse need to get it from slower storage such as a disk.
      Now there are things you can do to optimize the memory usage so it isn't as wasteful. However if you goal on low memory foot print chances are you are going to be sacrificing performance to use less memory.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    4. Re:You had me at.. by sirsnork · · Score: 4, Informative

      Have you told firefox not to remember all your downloads indefinately? It gets a little slow when it's remembered a couple of hundred downloads, and that was the default setting a long time ago, if you've been upgrading and never reinstalled your OS you've probably still got that default setting.

      In saying that, I use chrome now, once they decided to start bumping major versions every month or so, and upgrading broke at least one extension for a week, it was time to move to chrome. Oddly when I did I still preferred the FF UI, course now they have changed that to be more like chrome anyway.

      --

      Normal people worry me!
    5. Re:You had me at.. by Enderandrew · · Score: 2, Informative

      Please cite a documented case that isn't caused by an extension.

      Firefox hasn't had any major memory leak problems since Firefox 2.

      --
      http://blindscribblings.com - Tasty pop-culture in conceptual fashion.
    6. Re:You had me at.. by Anonymous Coward · · Score: 5, Informative

      Sorry, "leaks memory like a BP pipeline" sounds like the best description for a browser which seems to absolutely refuse to free up RAM used by old images loaded by Javascript that have since been kicked off the page. I can set up a timer to reload an image every, say, half hour* (think "weather report precipitation map" or "webcam image") on a machine that should be up 24/7, come in the next day, and have Firefox's "This page has a script that is not responding" popup because the OS was too busy thrashing swap after physical RAM filled up and Firefox thought it was the script's fault. It's not often I see the Mem and Swap meters in GKrellm2 solidly maxed out. For debug purposes, I can have it reload that image every five seconds and watch the memory steadily creep up every five seconds without ever doing anything resembling GC. Of course, if I close that tab, the memory returns instantly.

      Now, you might say that for a kiosk that should remain up 24/7 like that, I should consider a different means of presenting the data. And ultimately, I did consider a different means. Because neither Chrome/Chromium nor Opera have this problem. Using the exact same script on both browsers, once it reloaded the image, the old one was booted out of memory immediately, or at least quickly enough that any extra memory use was marginal and incidental, and certainly not to the point where it would suck down all of swap like Firefox did. In fact, this script is still running on a kiosk here, it has been for a couple weeks straight now, and there's no memory wasting in sight. Firefox wouldn't have lasted the first night without manually reloading the entire page.

      So yes. It's Firefox. Firefox leaks memory. A lot. It does this due to very poor cache decisions and inferior GC techniques. Period. This has been a known problem for some time; a cursory glance through Stack Overflow will find numerous questions regarding this exact situation and Firefox, none of which have conclusive answers besides "stop using Firefox". And the only common thread in all of them is Firefox. The problem is Firefox. Firefox is the problem. It leaks memory.

      *: Note that this is using the trick of appending the image's URL with a dummy timestamp variable to trick Firefox into not just loading the old image from cache despite pragmas and meta tags telling it not to. Point still stands, though: Chrome/Chromium and Opera understand enough to unload the previous image from RAM with the exact same script and usage.

    7. Re:You had me at.. by Anonymous Coward · · Score: 2, Informative

      I'm a Firefox fan, but even they've stated they had very bad memory problems.

      See this link: https://wiki.mozilla.org/images/9/93/LCA2012.pdf

    8. Re:You had me at.. by BlueStraggler · · Score: 2, Interesting

      So...can we put this cliche to bed now?

      Considering how appalling the memory leaks were for YEARS while the moz folks insisted there weren't any problems, it will probably take at least as many years before any of us believe anything they say about memory usage.

      I for one, won't believe they have any competence in memory management until I have spent 5 years without having to restart Firefox every other day.

    9. Re:You had me at.. by kbg · · Score: 5, Informative

      What, the hell are you talking about?

      Didn't you read this slashdot article: http://developers.slashdot.org/story/12/01/17/1338225/notes-on-reducing-firefoxs-memory-consumption

      Here is one of the relevant parts from the Firefox developer:

      "Finally, Firefox 4 had a new HTML5 parser. It had a bug which meant that every time you set an innerHTML property on an element, some memory would leak. And that’s a pretty common operation on many websites. "

      Please think before you post again.

    10. Re:You had me at.. by MightyYar · · Score: 5, Insightful

      Me to friend: Use Firefox! It has these awesome extensions! Definitely install AdBlock Plus, NoScript, Tree-Style Tabs, Auto Pager, IE Tab2, GreaseMonkey, Firebug, and the Developer Toolbar!

      Friend: Does your Firefox use every bit of your system's memory?

      Me: Pffft, well, only if I use the extensions!

      In all seriousness, they need to do something about the extensions. Refuse to host leaky ones or something. Extensions can't be Firefox's killer feature if they make it eat all of your RAM.

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    11. Re:You had me at.. by KiloByte · · Score: 5, Interesting

      Where do you pull that "3X faster" from? Without proper AdBlock, Chrome seems to be only about as fast as Firefox. With AdBlock installed and properly configured (ie, not just the defaults, including "non" (hah) intrusive ads), Firefox runs circles around Chrome. If you can't bother setting it up, try NoScript.

      That's just speed. Now try to factor in privacy, features or configurability. For example, in their default setting, Chrome crashes to desktop if you close the only tab. Someone on the Firefox team had the "brilliant" idea to ape that, and sadly, Firefox does that by default as well now. But fear not: "Close Last Tab" restores sanity. Also, tabs on top: I find myself using keyboard to access tabs only ~50% of the time -- the tab bar is accessed at least an order of magnitude more often than the URL bar, thus it should be more accessible. Again, the Firefox team aped Chrome's misfeature, but you can restore sanity easily. Get rid of the useless search bar? Here you go. Get rid of Google's typo-jacking? browser.fixup.alternate.enabled=false and keyword.enabled=false (you can type "google goat porn" if you want to search; rename the default keyword to "g" for convenience). Fix the http:/// being hidden for 1/3 sites that still didn't go SSL? browser.urlbar.trimURLs=false. And so on, so on.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    12. Re:You had me at.. by squiggleslash · · Score: 4, Informative

      Benchmarks are one thing, real life is another. I'm having to restart Firefox on a regular basis on my BRAND NEW EIGHT GIGABYTE LAPTOP. That's right:

      • In an age in which 1G netbooks are extremely common, I have eight times as much memory
      • It's a new laptop = fresh install of everything. The only thing carried over from my old machine was via Firefox Sync

      So if you're about to whine "But Squiggy! It must be your profile! And you need to get with the program and have 4G of RAM", there's your answer. I don't want to hear it.

      I really don't understand people like you who insist there isn't a problem when:

      • There's a massive groundswell of frustration and anger about the issue
      • Slashdot posts another "Mozilla reports - we found the problem! Next release will not have those memory problems!" article EVERY MONTH
      • Usage of CHROME, which in every other respect is an inferior browser to Firefox, is going through the roof

      You think we're making it up? You think everyone's just switching to Chrome for the hell of it? Clue: they're not switching because it's more compatible, or more user friendly, or has more features. Because nobody outside of a Google diehard would ever argue such a thing.

      We use Firefox for a bit. Some time goes by. Maybe we launch another application. Perhaps we view a PDF. And then it starts. It takes a second or more for Firefox to notice we clicked on something. The scrollbar is no longer real time. Switching a tab causes nothing to happen for ten seconds. We try closing tabs. We go to "about:memory" and hit every button. It seems... slightly faster. Or was that our imagination? Hmmm, it's gone slow again.

      I'm giving up. I downloaded Firefox 3.6 from Mozilla's website last night. I'm going to make it my default browser.

      --
      You are not alone. This is not normal. None of this is normal.
    13. Re:You had me at.. by Anonymous Coward · · Score: 5, Informative

      Of the 38 bugs listed there, about 5 were not memory leaks according to the subject. How many of those were because of addons?

      Then clicking on the first few bugs:
      - ONE GUY had addons and the dev requested a no-addon test. No reply.
      - This one look more promising but when the dev said "To find out it's a real memory leak or not, run 'prstat' command in a terminal.
      If the vaule of 'RSS' field of firefox row keeps increasing, it's a memory leak."... No reply.
      - ONE GUY had problem spamming the same URL into the URL bar. "Maybe have to close it" sounds like he wasn't even sure. Not a typical use case. (don't spam the URL bar with the same URL.
      - Agan one guy.
      - "The numbers you quote are not exceptional at all. They're probably caused by the malware-database that is updated in the background"
      - "The fix in bug 426236 fixes all the leaks, but it doesn't touch controllers..." fixed in 2008, but left open "just-in-case"

      Maybe you should actually look at the things before linking them?

    14. Re:You had me at.. by Anonymous Coward · · Score: 2, Funny

      And we're on what now, Firefox 82?

    15. Re:You had me at.. by jlebar · · Score: 5, Informative

      In all seriousness, they need to do something about the extensions. Refuse to host leaky ones or something. Extensions can't be Firefox's killer feature if they make it eat all of your RAM.

      We are so on this. In fact, add-ons are the majority of what we talk about at MemShrink these days.

      In theory, leak checking is now part of the addons.mozilla.org review process, so new add-ons will all undergo a (very basic) leak check before they're approved. I'm sure we'll have to tweak as time goes on, but it's a start.

      http://jlebar.com/2011/11/13/The_carrot%2C_the_stick%2C_and_the_wrench%3A_Add-on_leaks_are_everyone's_problem..html

    16. Re:You had me at.. by epine · · Score: 4, Interesting

      We live in a world where 8GB of RAM costs $50. I'm not sure how much I actually care whether Firefox uses 500MB vs. 2GB anymore.

      When my FF 3.6.3 gets above 1GB of virtual memory, it becomes a sluggish pig on my 8GB system. Frequent half second pauses. Characters blurt out ten at a time when I'm typing into a simple web form. I've always assumed this was a GC gag of some kind with worse than linear scaling as memory fragments.

      If it was using 2GB and never slowing down, I'd write it off as the cost of having a plug-in architecture. I have a lot of plug-ins. That's the whole point.

    17. Re:You had me at.. by UnknownSoldier · · Score: 3, Insightful

      > We live in a world where 8GB of RAM costs $50.

      Ah sweet, so you're offering to pay for upgrading/replacing netbooks and embedded devices with more RAM !

      Stop being a myopic PC developer with RAM means nothing -- there are other platforms where we actually care about RAM usage.

    18. Re:You had me at.. by MightyYar · · Score: 3, Insightful

      That is awesome - thanks. And I just read your team's memory presentation by Nicholas Nethercote :)

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    19. Re:You had me at.. by hazah · · Score: 3, Funny

      It parses the HTML as a bonus!

    20. Re:You had me at.. by Anonymous Coward · · Score: 3, Informative

      If you want to do something constructive about it rather than just ranting, file a bug (preferably with a self-contained testcase attached) and CC :njn and :jlebar to help triage.

    21. Re:You had me at.. by eexaa · · Score: 3, Insightful

      "Chrome is 3X faster"

      Dear sir, how did you obtain such an accurate measurement?

    22. Re:You had me at.. by garyebickford · · Score: 2

      Technically speaking, I don't think that fits the criteria of a memory leak. As I have always understood it, a memory leak is when a piece of memory has been allocated by the program, and then the program drops the reference to it without releasing it. This memory is then 'orphaned' and can't be found or used by any program.

      In any case, I think you have accurately connected it to garbage collection and cache management, and it should be fixed if so. So your point still indeed stands. :)

      --
      It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
    23. Re:You had me at.. by Just+Some+Guy · · Score: 2

      Out of curiosity, is that actually a significant memory leak? Yes, it's extremely bad form and the kind of thing that should be fixed ASAP. But did it result in a typical leak rate of a few KB per day, or would it lose 100MB an hour? Without that kind of information there's no way to tell if that's a real problem that affects people, or something more theoretical that should be fixed because it's the right thing to do.

      --
      Dewey, what part of this looks like authorities should be involved?
    24. Re:You had me at.. by kbg · · Score: 2

      Yes I would say so, innerHTML is used very much on many websites, it is especially bad when you have a site with dynamic content being refresh on an interval. But that is besides the point, all memory leaks are bad, when you have your browser running constantly for many months, any memory leaks wreak havoc. In this day and age having memory leaks in your application are a sign of bad developing practices and not enough testing for releases. The Mozilla team has a habit of focusing on useless stuff like tab groups, eye candy and rabid releases. Instead of focusing on creating solid, lean and fast browser that is massively tested.

      It seems to me Firefox has turned itself into Netscape yet again

    25. Re:You had me at.. by Mal-2 · · Score: 2

      I'm giving up. I downloaded Firefox 3.6 from Mozilla's website last night. I'm going to make it my default browser.

      You know they're forcibly upgrading FF3.6.x to FF12 in April, right?

      And that's when I bother to switch to another browser. I consider FF8 to be different enough (in ways I don't particularly like) to essentially be a different browser. If I'm going to go through all that trouble, I may as well switch completely. Chrome seems to be out, as (1) I don't particularly trust Google any longer, and (2) it seems to take a lot of RAM on my system (no I haven't investigated why, and I don't care to). Safari, on Windows? HAHAHA. IE8? Double fucking HAHAHA. So no, I haven't decided what to use yet.

      --
      How is the Riemann zeta function like Trump rallies? Both have an endless number of trivial zeros.
    26. Re:You had me at.. by bursch-X · · Score: 5, Funny

      You've got an 8GB system and complaining about FF 3.6 memory leakage?

      I'm not sure whether you are aware of it, but there's this cool way of replacing your application with a newer version (new: less than two years old). For free! It's called updating. I'm aware it's a radical concept, but try it out, it's pretty cool.

      --
      There are two rules for success:
      1. Never tell everything you know.
    27. Re:You had me at.. by steelfood · · Score: 2

      It's only a GC and cache problem IFF the GC actually knows the memory needs to be freed. If the GC doesn't realize that the memory needs to be freed (even though it's not being used), it's a memory leak.

      The garbage collector isn't some magical plastic memory cover that makes memory leaks bullet proof. Just because you don't have to manage your memory in Java doesn't mean a shoddy programmer can't write something that'll take up more and more memory, if only because he neglected to design the program in such a way that the stuff he's not using any longer falls out of scope and can be picked up by the GC (for example, instantiating everything in main).

      GC just makes it so that programmers don't have to explicitly manage their program's memory. But the programmer still has to understand memory management and design in such a way that the GC can do its intended work.

      --
      "If a nation expects to be ignorant and free in a state of civilization, it expects what never was and never will be."
    28. Re:You had me at.. by jawtheshark · · Score: 2

      Actually, many people have tried and 4GB works, but you only get 3.5GB because of chipset limitations. I've got a few machines like that. Not MacBooks, but just recently I had one of those early MacBooks on my workbench and I checked the possibility of upgrade online for that particular model. Official is 2GB, non-official 4GB.

      It really is hit 'n miss. For example, the dumpster-sourced machine my sister uses based on a Intel D945CGCCR. According to the manual it supports 2GB. Yet, I found an older manual where it claims 4GB. This was corrected in a later manual. I suspect, that it's because the chipset doesn't allow more than 3.5GB even in 64-bit mode. (it's an E6600, it can do 64-bit). Online forums came to the consensus that 4GB works (again, with the 3.5GB limit).

      My 2003 purchased AMD Athlon 2400+ MP on a Tyan Tiger 2466MPX also does this. 4GB allowed, but only 3.5GB usable *whatever you do*. As this isn't a 64-bit machine, you'd expect PAE to give you access to more. It doesn't, it is -again- a chipset limitation.

      Also, older DDR1 latops are often rated 1GB... In all those I tried, replacing with 2x1GB instead of 2x512GB, worked just fine. You cannot be certain, of course, but by now I just have test modules lying around...

      There is exactly one machine where I didn't manage to get it through the limit. It's a Fujitsu-Siemens Amilo Pa 1510. It's rated 2GB (DDR2) and it really doesn't want to do more. I tried 2x2GB with it (I had those lying around from another unfinished project), and it booted up with... 2.4GB. A bit more than the usual 1.8GB (~256MB for integrated graphics). So there was a win, but not really as much as a 2GB to 3.5GB upgrade.

      Now, of course, I admit I'm at an advantage because I'm a dumpster diver and have parts lying around I can test before buying anything online. Still, check what is being said about such upgrades "on the street". A good starting point is here. Good luck.

      --
      Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
    29. Re:You had me at.. by Waccoon · · Score: 2

      I've finally figured out the cause of [most of] the pauses. It's the session restore feature that saves the browser state, cookies, and session data every 10 seconds (in JSON format, no less). I've turned it off and the pauses are now almost entirely gone.

      • browser.sessionstore.interval = "300000"
      • browser.sessionstore.max_tabs_undo = "0"
      • browser.sessionstore.max_windows_undo = "0"

      Naturally, this will remove the feature that restores your tabs in the event of a crash, but seeing how little Firefox blows up on me, this features is hardly useful, and certainly not worth the frustration of constant pauses and missed clicks. Firefox is now finally usable for everyday browsing.

      Seriously, I've been hearing about this problem for years, and have been suffering with it since FF2, and nobody seems to have a clue what causes it. Personally, I thought it was a memory management issue. Turns out, it's just a bad design decision.

  2. SetTimeout by Anonymous Coward · · Score: 5, Interesting

    Maybe I'm missing something, but then how will "threading" (i use that term extremely loosely) methods like SetInterval and SetTimeout be implemented?

    1. Re:SetTimeout by drobety · · Score: 2

      A plain time-ordered job queue?

    2. Re:SetTimeout by The+MAZZTer · · Score: 5, Informative

      I am going to assume you are aware of how those functions work (specifically that they cannot interrupt the current thread if it is busy; they are only handled if the thread is idle) and that they themselves are not multi-threaded or have anything to do with multi-threading. It's not 100% clear from your post, though.

      Multi-threading in JS is handled by web workers.

    3. Re:SetTimeout by Anonymous Coward · · Score: 5, Informative

      The same way it's always been implemented. setTimeout is event driven; it adds an event to the event queue to be executed at a later time. Once your code returns, the browser can spin the event loop again. The timer event will come up in due course and the browser will reenter the js engine to call your function.

    4. Re:SetTimeout by The+MAZZTer · · Score: 5, Interesting

      Oh I read your post wrong; anyways I did answer your question in the first bit.

      Code sample:

      setTimeout("alert('This alert fires second.');", 0);
      for (var i = 0; i < 10000000; i++) { // Maybe do something in here that takes awhile. }
      alert("This alert fires before the other one.");

      Either your browser will display the alerts in the proper order despite the 0ms timeout (because timers are only handled when idle because they are NOT threaded) or your browser will get angry at the 10,000,000 iteration-long loop.

  3. us to hoist a lot data currently by ShakaUVM · · Score: 4, Insightful

    "us to hoist a lot data currently stored"

    I really wish I knew what this phrase meant. It sounds fascinating.

    But seriously, if there's no performance gain from multithreading, it can be a really good idea to move away from the complexity of it. There's a lot of traps people can fall into with concurrent code if they don't know what they're doing.

    1. Re:us to hoist a lot data currently by PhrostyMcByte · · Score: 3, Interesting

      They mean to replace multiple per-thread copies of data with one single copy of it, accessible by all threads. No doubt part of Mozilla's latest push to reduce memory consumption.

      One feature of x86 is that, save for a specialized SSE streaming store instruction, any store made by one core is immediately visible to all the other cores—even when the old value was already in a core's cache.

      Maintaining such cache coherency involves a lot of overhead, so to get better scalability multi-threaded apps will sometimes adopt a "share-nothing" model: all threads get their own copy of the data, and no other threads will ever get to touch it. You trade memory and complexity for speed.

      It sounds like Mozilla has decided this trade off is no longer worth it, and so has done away with multi-threading all together. Perhaps they will use green threads instead of native threads, though that brings along its own bag of complexities.

  4. Re:But... by allcoolnameswheretak · · Score: 3, Informative

    Single threaded is the safest way to program. Creating a multithreaded application without a strong multithreaded architecture is asking for trouble.

    The only problem with this is the limited performance and the fact that modern computers are packing more and more CPU's whereas individual CPU performance has been stagnating. Sooner or later people will have to work out the tools to create safe multithreaded applications without requiring a special degree in parallellization.

  5. Re:But... by msclrhd · · Score: 4, Informative

    What the article is saying is that each instance of the JavaScript runtime runs in one thread. If you want multi-threaded JavaScript, you need multiple runtime instances (one per thread). This is how WebWorkers work.

  6. Re:But... by 0xABADC0DA · · Score: 4, Informative

    Basically in a dynamically typed language like JavaScript every property access, function call, or any other thing that can be changed dynamically could be changed at runtime by another thread. So you need locking for every method call, property access, etc to make sure it isn't changed by another thread while it's accessed in another.

    There are some generally fast locking algorithms for when locks are used mostly by the same thread... for instance in Java locks can be owned by a thread and that thread never has to lock or unlock at all, but instead it periodically checks if another thread has written a flag saying it wants to become the owner, then there is synchronization to pass off ownership. This works ok for Java, where there are fewer things that can change at runtime and they are explicitly listed out (using 'synchronized'), but in a dynamic language it's usually just too much overhead.

    Just for comparison V8 is even more extremely single-threaded, with execution that can only be interrupted at some certain points in the JS code.

  7. Re:God saves his son 1st, Jesuchrist. by K.+S.+Kyosuke · · Score: 2, Funny

    It's an evil sentence for saving the tiranny originated by the supposed saved Queen

    I'm puzzled. Since when does the UK have such a strong pro-Albanian foreign policy?

    --
    Ezekiel 23:20
  8. A mistake by claytongulick · · Score: 3, Informative

    My initial sense of this, is that they are making a huge mistake here. I'll have to do more research, but my feeling is that they are moving in the wrong direction with this decision.

    One of the really cool "baked in" things with functional style language is their fundamental support for horizontal scaling across CPUs. My hope has been that javascript evolves towards this, so that the generic suite of functional methods become massively performant on a larger scale with map/reduce/fold/each calls.

    Closures present a bottleneck here, but it seems like a reasonable runtime could make some intelligent prediction about whether the isolated function is a closure or not, and ship it off to a different CPU/thread depending on optimization strategies, or even estimated closure size. Even better, this could be done at runtime with some runtime optimization based on execution metrics of an anonymous/declared function in-context.

    At the point of calling the map/reduce/fold/each function, the runtime should be able to decide whether to parallelize out the call, or even use some language extensions to let the developer specify the threading.

    The point is, now that they're making this decision, all of those options are gone from FF. And at a terrible time too. As we move toward CPU architectures that encourage parallelism, Mozilla is taking js off the table as a first-class language able to easily exploit those new architectures. That strikes me as a huge mistake, and I'm struggling to understand the rationale.

    --
    Drinking habits can be dangerous. You can choke on the cloth and the nuns will wonder where their clothes are.
    1. Re:A mistake by msclrhd · · Score: 3, Informative

      The old JavaScript runtime supported multi-threading in the runtime itself. This resulted in the need for complex threading/locking code to make sure that data was being accessed correctly. This is hard to maintain, easy to get wrong, consumes more memory and slows down things like garbage collection.

      The new JavaScript runtime is single-threaded. WebWorkers each have their own instance of a (single-threaded) JavaScript runtime that may be running on different threads.

      You can still have your map/reduce/fold/... functions running in parallel; they will be implemented on top of WebWorkers. As the representation of each runtime is simpler, the engine as a whole can optimise the work between threads better and perform better code generation.

      It also means that garbage collection is faster as it (a) does not navigate all memory allocated across all threads and (b) only blocks the thread the garbage collector is currently running on.

  9. *More* outsourcing?! Bloody "globalization"! by zooblethorpe · · Score: 3, Funny

    Multi-threading in JS is handled by web workers.

    Oh, great! So now we're outsourcing even more textile jobs to anyone willing to work online, is that it? Sheesh!

    (On a more serious note, thank you for that informative link.)

    --
    "What in the name of Fats Waller is that?"
    "A four-foot prune."
  10. Caring by SuperKendall · · Score: 2

    We live in a world where 8GB of RAM costs $50. I'm not sure how much I actually care whether Firefox uses 500MB vs. 2GB anymore.

    If only four applications you keep open all the time feel the same way you start caring quickly.

    Swap is still annoying. Even when you have an SSD and cannot hear it...

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:Caring by jedwidz · · Score: 2

      I've heard that recommendation a lot but I fail to comprehend the logic behind it.

      If you don't want/need swap, you can optimize for performance by disabling it.

      If you do want/need swap, you can optimize for performance by using a fast drive, e.g. an SSD.

  11. The boy who cried "Leak!" by jlebar · · Score: 4, Insightful

    So while they may have fixed most of the memory leaks (it still runs like shit on a Mac), let us not allow them to get complacent again. [snip] By not frequently reminding them about memory leaks, you are opening the door to yet more bloat going forward.

    I believe there's a parallel with a common fable:

    You saw a wolf. I said I shot many, that the wolf situation should be improved, but you kept seeing wolves. This repeated many times and made you angry.

    Now lots of others are saying that there really are fewer wolves these days. Indeed, you have no reason to believe that they're wrong.

    But because of the offense done to you some time ago, you're going to continue crying wolf, even given no evidence at all?

    I don't understand. I guess this is an attempt to punish us? Is it that you feel like we harmed you with our lies, so you should try to harm us with yours? I'm afraid that by crying wolf, and encouraging others to do the same, may just cause us to ignore you all, which is exactly the outcome you don't want.

    I'm very sorry you feel like Mozilla deceived and harmed you. But the malicious attitude here and elsewhere in this thread is getting old. Use Chrome, if you like! But don't encourage people to waste developers' time with false claims.

    1. Re:The boy who cried "Leak!" by Lisandro · · Score: 2

      I'm very sorry you feel like Mozilla deceived and harmed you. But the malicious attitude here and elsewhere in this thread is getting old. Use Chrome, if you like! But don't encourage people to waste developers' time with false claims.

      I feel the need to chime in here, because my original (humorous) post started this flood of responses. I like Firefox a lot, but still, I experience memory leaks all the time, even with latest versions. And from what i hear, i'm not alone either. It is not mass delusion.

      Now, some people to this subject respond passionately, like if their favorite team were involved, which just boggles my mind.

      I really appreciated when the FF team started addressing memory usage not too long ago (it really has improved things in latest versions) and i also appreciate knowing that the team is pursuing active testing of extensions for leaks, which seem to be the main culprit most of the time. If anything, i'm thankful.

    2. Re:The boy who cried "Leak!" by jlebar · · Score: 2

      My experience: I can't load Yahoo Mail for any length of time in Firefox without it turning to mush. If I leave Firefox open for a couple of days with mostly static tabs, twitter excepting, and make the mistake of using other applications, it'll turn to mush. And by mush I mean swap hell when you try to scroll a web page, that kind of thing.

      [snip]

      So... look, if we didn't love Firefox, we wouldn't be upset.

      If you love Firefox, please file a bug (bugzilla.mozilla.org) and cc me [:jlebar]. Bugs from the community are how most of these problems get identified and fixed -- we simply don't have the testing resources that Google, Apple, or Microsoft has. We rely on you guys as much as you rely on us.

      If you file a bug (or if anyone else reading this thread files a bug), I promise I'll take a serious look and try to understand your problem.

    3. Re:The boy who cried "Leak!" by jlebar · · Score: 4, Informative

      Firefox has 400 million users. (That's 1/20th the world's population, for those following along at home.) Any time we make a UI change, some of these 400 million people will love it, and some of those 400 million people won't. I'm sorry you didn't like this change.

      There's an add-on to get the status bar back. Can we move on, please?

      https://addons.mozilla.org/en-US/firefox/addon/status-4-evar/

    4. Re:The boy who cried "Leak!" by webnut77 · · Score: 2

      First, let me thank you, jlebar, and the other Firefox developers for all the work you do on FF. I use it with FireBug to develop web pages and they are invaluable tools that help me do my work.

      It is because we love FF that we are complaining. If I didn't care about FF, I wouldn't even bother complaining. I would just move on.

      I never understood the reason for removing the status line. I've heard the reasoning that it saves vertical space for the laptop/tablet/smartphone users. However, this reasoning really doesn't hold water since all along a user could easily disable it. I, for one, constantly use the status bar and am alarmed by the decision to remove it. Someone has decided for me that I don't need it.

      I've seen posts here on Slashdot from one user that thinks the desktop is now a dinosaur and will eventually die off. This is a ludicrous idea that I fear the the FF developers are buying into. I have 19 FF windows open spread over two 24 inch monitors which allows me to view documentation as well as the web page I am currently developing. I also have 7 Xshell widows open to monitor a few servers. Can't see all this happening on a tablet let alone a smartphone.

      To wrap this up, I hope this provides some insight to the frustration that I, and others, are experiencing.

      PS. I wouldn't even begin to know what to put in a bug report about the memory problems. Seems like someone in the FF organization should be able to leave FF open two or three days and use it extensively to re-create the problem. Watch a few Netflix movies, configure Zabbix, and leave the @#$% Slashdot main page open that refreshes itself despite my profile indicating not to. FF will slow to an unbearable crawl. Windows XP Pro 64-bit with 8 GB RAM.

    5. Re:The boy who cried "Leak!" by jlebar · · Score: 2

      "My experience: I can't load Yahoo Mail for any length of time in Firefox without it turning to mush. If I leave Firefox open for a couple of days with mostly static tabs, twitter excepting, and make the mistake of using other applications, it'll turn to mush.

      And by mush I mean swap hell when you try to scroll a web page, that kind of thing.

      This isn't just happening on my 1.5Gb VM at work or 1Gb Netbook, it's happening on my 8Gb freshly installed no-profile-other-than-that-produced-by-Firefox-sync no-extensions-even-AdBlock Ubuntu machine."

      Sweet jesus, man, he just gave you a description right there. Although I'm not on the FF dev team, that sounds like a damn memory leak to me.

      This is a common /. misconception, that "bug reports" like this are actionable.

      There are so many things missing from this: The reporter's operating system, which version of Firefox is affected, whether Firefox is actually swapping or the disk is spinning doing something else... We'd want to see if the garbage collector is making Firefox slow. We'd want to see if a newer version of Firefox doesn't have this problem. Like another poster said, we'd want to have a look at about:memory before and after the problem occurs. Moreover, if the problem has to do with Yahoo Mail specifically, it may have to do with the reporter's specific YM configuration. Enough Firefox users use Yahoo Mail that if anyone who opened it experienced cringe-worthy performance, we might have heard about it.

      The quote above is a fine initial post in a bug report. But we'd need to go back and forth for a bit to establish set of steps to reproduce that might lead a developer somewhere.

  12. Never need to restart firefox by Chirs · · Score: 2

    As a separate data point, I've never had to restart firefox either on my 8GB work laptop running linux or on my 3GB home laptop running Win7.

  13. Re:OM NOM NOM! by Zan+Lynx · · Score: 3, Informative

    A dozen tabs huh? Okay, I get a dozen tabs open, including Facebook, G+, a few Amazon pages and Slashdot. I've got NoScript and Firebug installed.

    My Firefox 9.0.1 is using 1.3 GB of virtual, but only 514 MB of real, actual memory.

    Double check what the title of the column is where you're reading the memory usage from. Or try looking at about:memory in Firefox.

  14. Re:OM NOM NOM! by Anonymous Coward · · Score: 2, Interesting

    And my Opera 11.60 with 23 tabs running for two weeks uses 919M virtual, 630M private and 527M physical.

    Looks like FF is as memory hoggish as ever.

  15. Re:However, 10+ Years After 64-Bit by loufoque · · Score: 2

    You have twice as many registers, which are each twice as big.
    Spilling to memory is much more costly than a cache miss.

  16. Firefox 9 unusably slow on system with 128M of RAM by bzipitidoo · · Score: 4, Informative

    As an exercise in insanity, I tried to install a modern Linux distro on an old Pentium II system with only 128M of RAM. Used btrfs for the heck of it. It was all going well until I tried to run Firefox 9.0.1. Thrashed that system mercilessly. Never mind actually showing a web page, just starting up blank was extremely slow. Sometimes I saw the "unresponsive script" popups on Firefox's own Javascript. I hacked out everything that used memory, dumping the LXDE desktop environment for a plain old window manager (jwm), and this helped, but it's not enough. Turned off images and disabled Javascript. It still thrashes swap.

    Chrome didn't do any better. Firefox 3.5 worked okay on an even smaller system (96M of RAM). Version 3.6.8 + LXDE works fine on a system with 192M of RAM. Here's hoping their MemShrink effort scores more big wins.

    --
    Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"