• ditty@lemm.ee
    link
    fedilink
    English
    arrow-up
    106
    ·
    26 days ago

    I switched back to Firefox over a year ago and I have not noticed it using much less RAM than Chrome tbh. It’s definitely the better browser for all the other reasons, but I wouldn’t list memory utilization as a big advantage over other browsers

    • cm0002@lemmy.world
      link
      fedilink
      arrow-up
      84
      arrow-down
      2
      ·
      26 days ago

      The whole RAM thing is way overblown. Both browsers request a lot of RAM allocation, but only actually use a fraction of it. When the OS needs it for another process this “allocated, but unused” pool is the first to get used when “Free and unallocated” is gone

      Problem is windows reports it all as the same in the task manager so people see that “70%” usage and freak out.

      Tl:Dr Windows task manager is a fuckin lier.

      • otacon239@lemmy.world
        link
        fedilink
        arrow-up
        56
        arrow-down
        3
        ·
        26 days ago

        There’s also the idea that free RAM is somehow a good thing. In an ideal system, the RAM would always be “full” of potentially useful data. Having a bunch of empty RAM means that it’s not being useful. That space could be used to hold plenty of regularly used files that would be instantly loaded instead of having to pull from the drive again.

        I don’t know when everyone started getting concerned with RAM usage, but in a perfect system, it would hold onto all of your frequently used programs and files that it could fit from boot and then those would load instantly.

        Some Linux distros even allow loading the entire OS into RAM for wild speeds.

        Idle RAM is just that. It does you no favors. Now, I do understand that you don’t want to be completely out, but we act like having 80% free is a goal for some reason.

        • Badabinski@kbin.earth
          link
          fedilink
          arrow-up
          25
          ·
          26 days ago

          The problem is that the extra RAM used by a browser is held on an exclusive basis and so is not nicely reclaimable by the kernel. I love that Linux caches the shit out of files in RAM, it’s great. It’s also great that it can release that memory when I launch a chundering dumpster fire application that eats all of my RAM. If a browser had been holding that memory, then the godawful Linux OOM killer would have launched, halted all threads on the system, walked the entire process tree, and SIGKILLed something (probably not a browser tab) before letting everyone else resume.

          With the way memory is currently managed, a bloated browser is a liability. Cached state needs to be stored in something like a mmaped file so that the kernel can flush pages out of memory if someone else comes along with a malloc. Alternatively, there needs to be communication between a browser and a userspace OOM daemon. If the system started hitting a soft limit, then the browser could start unloading background shit more aggressively.

          Free memory is wasted memory, but so is memory that can’t be used for anything else when it’s needed.

          • otacon239@lemmy.world
            link
            fedilink
            arrow-up
            11
            ·
            edit-2
            26 days ago

            Yeah, I agree. Browsers all seemed to act like they are the only thing running on the computer at some point, practically resembling their own OS with the amount of containerization and complexity. There should definitely be a way for the OS to request some RAM be released from the browser.

            • Draconic NEO@lemmy.dbzer0.com
              link
              fedilink
              arrow-up
              3
              ·
              25 days ago

              That’s why I just prefer to limit the RAM available to the browser to an amount that I feel is necessary for good performance while not so much that it causes issues with other things running. To some people that might sound like a bad or stupid idea but think of it this way. You just said that modern browsers are complex and resemble their own Operating System, right? Well if you were running a VM you probably wouldn’t give the virtualized OS complete access to all your RAM, that’s asking for the VM to crash or freeze your PC. So why should general practice be any different for a browser then, they may be less aggressive than a Kernel managed VM but they can still be problematic when they eat to much RAM. Which is why I choose to limit mine so it doesn’t get more than 8GB, which I feel is perfectly reasonable on most systems where that’s half of all the memory available, and even on bigger ones you’re not missing out on much. Firefox performs just as well with 8GB as it does with 16GB, but with 16GB it’ll eat way more than it uses.

              Here’s the script I used. Should work for most linux users. I don’t know how to do it on Windows since I don’t use Browsers there for long enough periods for this to become problematic.\

              Desktop file to limit Firefox to 8GB of RAM
              [Desktop Entry]
              Version=1.0
              Name=Firefox RAM limit 8GB
              GenericName=Firefox Ram limit 8GB
              Comment=Limit RAM for Firefox to 8GB;
              Exec=systemd-run --user --scope -p MemoryLimit=8G firefox
              Icon=firefox
              Type=Application
              Terminal=false
              Categories=Utility;Development;
              StartupWMClass=Firefox
              

              CC: @Badabinski@kbin.earth

        • AVincentInSpace@pawb.social
          link
          fedilink
          English
          arrow-up
          16
          arrow-down
          3
          ·
          26 days ago

          Unused RAM is wasted RAM. It consumes the exact same amount of power whether there’s useful data in it or not. Any self-respecting operating system will fill up RAM that applications aren’t using with frequently accessed files, so they’re ready to go in an instant.

          • Draconic NEO@lemmy.dbzer0.com
            link
            fedilink
            arrow-up
            13
            ·
            edit-2
            25 days ago

            I think that’s precisely why limiting RAM on apps like Chrome or Firefox is so necessary, these apps never release their RAM when they are supposed to, they hoard anything that isn’t free and don’t give back when it’s needed, which is why in the reply to the top comment I shared a desktop entry to limit RAM on Firefox or whatever app you so choose.

            • AVincentInSpace@pawb.social
              link
              fedilink
              English
              arrow-up
              4
              arrow-down
              1
              ·
              edit-2
              25 days ago

              Oh, I totally agree. Being afraid to call out to the allocator because “hey, I might need that memory later” is kinda not great. To a certain extent I can see how if an application tends to thrash memory, making a kajillion syscalls might hurt performance, enough that on many machines the gains from doing a single big allocation on the system and then slicing it up into small allocations in-process might outweigh the downsides, but still…

        • Draconic NEO@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          9
          ·
          25 days ago

          Having programs steal or sit on RAM without using it is never a good thing. That’s why it’s called a memory leak, because it’s as if the free memory is leaking away. And it gets deprived from other apps that might need it more than Firefox or chromium does.

          Your idea only works if programs actually take only as much ram as they need and give it back when done, but they don’t do that, they usually sit on it until it’s pried from their cold dead fingers. That’s what memory leaks are, and modern browsers these days are extremely prone to them.

    • Draconic NEO@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      12
      ·
      edit-2
      25 days ago

      Most browsers these days have issues with high RAM usage, and memory leaks to. I’d recommend trying to limit the RAM of the browser, it stops it from eating up so much.

      Here’s how I did it on linux. I’m sure there’s a way to do it if you’re on Windows though (might not be as good though).

      Desktop file to limit Firefox to 8GB of RAM
      [Desktop Entry]
      Version=1.0
      Name=Firefox RAM limit 8GB
      GenericName=Firefox Ram limit 8GB
      Comment=Limit RAM for Firefox to 8GB;
      Exec=systemd-run --user --scope -p MemoryLimit=8G firefox
      Icon=firefox
      Type=Application
      Terminal=false
      Categories=Utility;Development;
      StartupWMClass=Firefox
      

      This is a script to limit Firefox to 8 gigabytes of RAM, you may change it lower or higher depending on what your needs are by changing the number from 8 to whatever else you’d like. Fair warning though setting it too low will cause Firefox to lag very badly, and will crash chromium browsers outright (Ask me how I found out).

  • AVincentInSpace@pawb.social
    link
    fedilink
    English
    arrow-up
    75
    arrow-down
    1
    ·
    26 days ago

    JUST BECAUSE I USE FIREFOX DOESN’T MEAN I’M A FURRY!

    I mean, I am a furry.

    BUT NOT BECAUSE I USE FIREFOX!

  • Draconic NEO@pawb.social
    link
    fedilink
    arrow-up
    45
    arrow-down
    6
    ·
    25 days ago

    Hating furries is already really cringe, but even more so when you have an anime profile picture. At that point it feels hypocritical.

  • arc@lemm.ee
    link
    fedilink
    arrow-up
    23
    arrow-down
    3
    ·
    25 days ago

    The weird thing to me whenever anyone complains how much memory a browser takes up, is what do they think the free RAM is doing otherwise? It’s free so why can’t an application use it? And that’s what browsers do, taking the memory to use as a cache, and releasing it back to the system if available memory dips below some threshold.

    • Psythik@lemmy.world
      link
      fedilink
      arrow-up
      9
      arrow-down
      2
      ·
      25 days ago

      Also, modern OSes are designed to fill as much of your RAM as possible. Windows does it, Android does it; pretty sure Linux and MacOS does too. The number you’re looking at only shows the RAM usage by currently running processes. Unused RAM is wasted RAM, so your OS will fill as much of it as possible with prefetched data so that your machine will be more responsive when you actually need to use the data that was stored in advance for you.

      • IceFoxX@lemm.ee
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        24 days ago

        Um, isn’t only the addressable area reserved for the respective application? In other words, it doesn’t even mean that the application fully utilizes the memory, but that the memory is continuously available for the application.

        • Buddahriffic@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          24 days ago

          Each application has a full address space limited only by the number of address bits they use (which is way higher than the amount of physical RAM any machine uses, maybe even more than all RAM in existence for 64bit, since it can address space into the quintillions of bytes, or millions of terabytes).

          It’s only when they try to use a page of memory that the OS then reserves a physical page of memory that maps into your physical RAM. Allocating that space is a part of the page miss interrupt handler, which gets raised when a program in user space tries to access a memory address that isn’t stored in the CPU’s MMU.

          When it gets that interrupt, the OS will check its own memory allocation table for that address (which stored in RAM and is larger than the CPU’s hardware table) to see if it just needs to add the entry to the MMU, page it in from disk to a free page in RAM (possibly needing to page another page out to disk if there are no fee pages), or allocate a new entry to a free page (again maybe requiring a page out).

          I believe Windows task manager (or Linux top) displays the total number of allocated pages * page size for how much memory a program is using. There might be a seperate column for how many pages are in physical RAM vs the page file.

          Though there might be another path to get the OS to allocate pages before a page fault occurs, so it might not reflect the actual used memory. But allocating a new page on page miss isn’t very expensive when there’s free pages. Just a few table lookups and it goes back to the program. Paging out is more expensive, since each byte needs to be written to disk. Paging in is most expensive, since it usually involves a page out (because memory needs to fill up before a page out, so there’s a good chance one needs to be freed) and then every byte of the desired page needs to be read from disk.

  • MystikIncarnate@lemmy.ca
    link
    fedilink
    English
    arrow-up
    28
    arrow-down
    8
    ·
    25 days ago

    I work in tech, and I don’t understand people’s obsession with having all their RAM free at all times.

    If you don’t use it, why do you have it?

    Windows (not the best OS, but the one I know the most about), will lie to you about how much memory you have that’s free. It puts data in RAM as cache. In the event you need that data, it’s already loaded in RAM. Usually this is stuff like DLLs and executables for programs.

    There’s a difference between “free” memory, and “available” memory.

    In addition, RAM is always going down in price, so 32G today costs what 16G did, some number of years ago. The same can be said for 16G vs 8G, etc. Though, the comparison becomes less relevant as you get into much smaller and older memory types, since the cost per dimm will only ever go so low.

    Buy the memory, use as much of it as you can, as often as you can. Go wild with it. Enjoy.

      • Draconic NEO@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        3
        ·
        25 days ago

        Browsers have a really hard time with the last part. Hence why I recommended limiting it to something more manageable, that way it doesn’t chew up everything available.

    • Draconic NEO@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      13
      ·
      25 days ago

      There’s a difference between “free” memory, and “available” memory.

      I agree with this, and I’m sure most people complaining about Firefox or Chrome’s abhorrent memory usage would too. The problem with most browsers is that they eat up the available memory and often do not give it back. So you end up with situations where you’re running low on available RAM even though you have 32GB installed.

      Buy the memory, use as much of it as you can, as often as you can. Go wild with it. Enjoy.

      Sure, if you release it when not using it, otherwise unlimited RAM privilege revoked. Memory leaks suck and when they chew up all your RAM and they continue to happen, offending apps should either be no longer used, or limited to their minimum necessary RAM requirements to limit the damage they’ll do.

      Hence why I capped Firefox at 8GB, anything more would be wasted when it inevitably leaks.

      Desktop file to limit Firefox to 8GB of RAM
      [Desktop Entry]
      Version=1.0
      Name=Firefox RAM limit 8GB
      GenericName=Firefox Ram limit 8GB
      Comment=Limit RAM for Firefox to 8GB;
      Exec=systemd-run --user --scope -p MemoryLimit=8G firefox
      Icon=firefox
      Type=Application
      Terminal=false
      Categories=Utility;Development;
      StartupWMClass=Firefox
      
    • daddy32@lemmy.world
      link
      fedilink
      arrow-up
      14
      arrow-down
      1
      ·
      25 days ago

      None of thaťs helpful. You know, when browser uses half your ram, teams quarter and rest of the programs the rest, windows is swapping on your SSD like a prick and you cannot switch windows - none of what you said helps. And of course, the RAM is soldered on and cannot be expanded.

      • MystikIncarnate@lemmy.ca
        link
        fedilink
        English
        arrow-up
        5
        arrow-down
        1
        ·
        25 days ago

        I understand your point.

        This is also why I don’t buy systems with soldered RAM. It’s a horrible trend in computer systems that RAM is soldered. It’s a lazy way to fix a problem and nobody should buy a system like that.

        The industry needs to come up with better solutions.

    • Hello Hotel@lemmy.world
      link
      fedilink
      English
      arrow-up
      10
      ·
      edit-2
      25 days ago

      For me there are programs that “can acceptably use that much RAM” and those that it’s “unacceptable”, to me. what’s 20% to 40% of my gaming rig’s resources may be uncomfortably taxing and laggy for my laptop. Its okay to waste resources on my gaming rig but the laptop needs all it can get. I accept some software will not reasonably run on the laptop. My employer has stuck me on 10yo hardware before, running windows 10 pro + intrusive expensive antivirus and nobody is around to question why their computers are getting 5-15fps and locking up for a minute or two when you open chrome. It becomes normal. Any software is the host and/or backbone for other running software should focus on reducing it’s own resource usage for the sake of its children.

    • Arthur Besse@lemmy.ml
      link
      fedilink
      English
      arrow-up
      5
      ·
      edit-2
      25 days ago

      I work in tech, and I don’t understand people’s obsession with having all their RAM free at all times.

      If you don’t use it, why do you have it?

      Windows (not the best OS, but the one I know the most about), will lie to you about how much memory you have that’s free. It puts data in RAM as cache. In the event you need that data, it’s already loaded in RAM. Usually this is stuff like DLLs and executables for programs.

      There’s a difference between “free” memory, and “available” memory.

      Linux and macOS do the same, although I wouldn’t call it lying per se :)

      There is certainly a lack of understanding of the difference between free and available RAM. TLDR: yes, free RAM is indeed wasted RAM.

      If you actually have a lot of free RAM, it’s probably because you either booted or freed a lot of RAM very recently. After using your computer for a while, most of your available RAM should not be free but rather being used for page cache and other caches.

      After a program has just read and/or written more data from disk than will fit in available RAM, the kernel’s page cache (which is typically the bulk of that not-free-but-available memory) should be mostly populated by the most recent of those operations. This means that if that program (or any other program) reads those files again, before they are evicted from cache by other things, they will not need to wait for the disk and will get them back much faster.

      However, managing all of this is the kernel’s job, and the not-free-but-available RAM being used for page cache is not (in any OS, as far as I know, though I mostly know Linux) attributed to the program(s) responsible for putting things there.

      So, when people are complaining about an application using 40% of their RAM it is not necessarily due to them misunderstanding free-vs-available RAM. The used number for an application does not include the portion of the system’s not-free-but-available RAM which the application is also responsible for occupying.

      (If you want to know which programs and/or which files are responsible for occupying your page cache… on Linux at least, it is not really possible without instrumenting your kernel. The kernel is just tracking blocks. There several tools which will let you see which blocks of a given file are cached, but there isn’t a reverse mapping from blocks to files.)

  • N.E.P.T.R@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    13
    ·
    26 days ago

    I honestly dont care about my browser using a lot of resources (processes, RAM, etc) because it may be helpful to the isolation security model of the browser. Each and every website is a possible malicious app.

    • TriflingToad@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      4
      ·
      25 days ago

      I got tired of cleaning them out so I stopped. Now I have an emotional attachment to my 200+ tabs on Firefox mobile 🥹
      I have so many the counter turned to infinity lol

    • Swedneck@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      25 days ago

      counterpoint: why does it need to keep the tabs in ram? either just discard the data and only keep the url, or if it would otherwise double check whether you want to close a tab then save things to disk cache after 5 minutes…

    • Infomatics90@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      25 days ago

      I don’t understand this. The only people i have seen with a boatload of tabs open are twitch streamers. I have like maybe 5 open MAX and that’s rare.

  • Vince@lemmy.world
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    26 days ago

    What is the acceptable amount of ram a browser should be using? Is there a way of knowing how much is “wasted”? Is it even possible to waste ram, like what is wasted, time? Electricity?

    • bassomitron@lemmy.world
      link
      fedilink
      English
      arrow-up
      16
      arrow-down
      1
      ·
      26 days ago

      It’s only a problem if it doesn’t give it up when other apps need it and there’s not enough. Browsers just cache a bunch of shit in memory for speed and convenience, but they should unallocate it back to the pool if something else calls for it. The internet complaining about this for years and years are mostly doing so from a place of ignorance.

      • Badabinski@kbin.earth
        link
        fedilink
        arrow-up
        6
        ·
        26 days ago

        The issue is that browsers don’t release much memory back to the system when it’s needed. I wish they’d work more like the Linux kernel’s VFS caching later, but they don’t (and might not be able to. For example, I do don’t think the Linux kernel has good APIs for such a use case).

        • zea@lemmy.blahaj.zone
          link
          fedilink
          arrow-up
          3
          ·
          26 days ago

          You can write limits to and then poll files in /proc/pressure/ to be notified of resource pressure. Systemd will also set an environment variable for similar files for your cgroup.

      • Badabinski@kbin.earth
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        26 days ago

        The issue is that browsers don’t release much memory back to the system when it’s needed. I wish they’d work more like the Linux kernel’s VFS caching later, but they don’t (and might not be able to. For example, I do don’t think the Linux kernel has good APIs for such a use case).

        • bassomitron@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          arrow-down
          1
          ·
          edit-2
          26 days ago

          It does release it back to the system. It only doesn’t if you actively have a ton of windows/tabs open, in my experience. Even then, it’ll cache stuff to disk after awhile. Like on my phone, I’ve easily had over 20 tabs open in Firefox (Android) and it doesn’t suck up all of my phone’s ram (which only has 12GB). If your system is running less than 16GB, then that’s another matter and you really should add more, as 16GB is pretty much the baseline on computers these days.

          • Draconic NEO@lemmy.dbzer0.com
            link
            fedilink
            arrow-up
            1
            ·
            25 days ago

            Mine is 32GB and Firefox as consistently and repeatedly refused to release the excess RAM back into the pool. So it doesn’t work out as well in practice as it does on paper. I would agree that 16GB is the bare minimum though and if you have less you absolutely should get more if you can. Firefox needs at least 8GB to run smoothly, but a system that only has that amount or less will be bogged down by Firefox alone.

            • bassomitron@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              edit-2
              25 days ago

              I don’t know what to tell you, then. I’ve never had Firefox or chrome be that stubborn on a consistent basis. Are you using extensions? Some extensions are very poorly optimized, especially so when combined with certain websites (gotta love badly implemented JS in some places). Even if the extension is well made, they can still get overwhelmed sometimes, e.g. ublock origin on sites with very aggressive ads.

              That being said, browsers are very complicated and the fact they all heavily use sandboxing now (as they rightfully should be), I guess I’m not surprised where they don’t function as intended in various use cases.

              • Draconic NEO@lemmy.dbzer0.com
                link
                fedilink
                arrow-up
                1
                ·
                25 days ago

                Even if the extension is well made, they can still get overwhelmed sometimes, e.g. ublock origin on sites with very aggressive ads.

                Maybe that’s part of the issue, I’ve seen uBO say it blocked 8K+ ads on certain sites.

                That being said, browsers are very complicated and the fact they all heavily use sandboxing now (as they rightfully should be), I guess I’m not surprised where they don’t function as intended in various use cases.

                Yeah that’s very true, Browsers these days are becoming more like virtual machines. I guess it makes sense you wouldn’t give all your RAM to them just like you wouldn’t give all your computer’s main RAM to a Windows VM.

            • AdrianTheFrog@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              25 days ago

              I’m on 4gb of ram right now (travelling so I’m away from my desktop) and firefox is using ~2gb I think (only 4-6 tabs open though)

              • Draconic NEO@lemmy.dbzer0.com
                link
                fedilink
                arrow-up
                1
                ·
                25 days ago

                I guess with a small amount of tabs it can work better, but with 400 tabs and 12 extensions it definitely does struggle. When I first used the .desktop files to limit the ram I accidently set it at 1GB and everything started lagging and freezing in Firefox, it really didn’t like it. At least I learned that the RAM limiting method I found really did work because of that.

    • Euphoma@lemmy.ml
      link
      fedilink
      English
      arrow-up
      5
      ·
      25 days ago

      Its being wasted if a memory leak causes it to use all 32 gigs of ram and crash

      • Draconic NEO@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        3
        ·
        25 days ago

        Even if it doesn’t eat that much if it latches on to a portion of Memory and won’t give it up unless killed that’s still bad, and would be considered wasted as nothing else can use it for anything.

      • Draconic NEO@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        25 days ago

        Somehow I don’t really agree with that theory when Firefox was chomping down on 31.5GB of RAM and causing other things to crash or slow down (crashed Gnome shell a few times which was fun), as well as crashing often itself. When I limited the RAM to 8GB using the method outlined in my other comments all the mentioned issues went away. It would run smoothly, and old tabs would just unload, something which didn’t happen before. And most of all, everything else ran smoothly without issues or hiccups.

        Moral of the story, when apps leak RAM, limit their RAM. RAM held by apps and not being released is just as wasted as if it wasn’t used at all, because chances are it isn’t being used at all, and isn’t able to be used.

    • Draconic NEO@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      2
      ·
      25 days ago

      If an app allocates it and ever uses it and refuses to give it up unless killed that can be considered wasted. It’s called a memory leak and they can be really bad, especially when they consume a lot of memory, as that memory might as well be empty but is being held hostage by other apps.

      If they released RAM then whatever amount they were using wouldn’t be wasted and if more is needed they’d simply release it to free up resources. That hasn’t been happening though, and most modern Browsers are notorious for consuming massive quantities without releasing it back to the pool.

      In that case with the presence of Memory leaks being considered, and the fact that they continue to not be fixed, the acceptable amount of RAM a browser should be using (should even have access to) is the minimum necessary to run smoothly. From my testing with Firefox that seems to be 8GB. 4GB caused many websites to struggle. Such an arrangement ensures that even if a Browser begins eating RAM it won’t eat up all the RAM and cause issues, worst that’ll happen is that it itself will crash from eating all the 8GB it was allowed to access.