• ditty@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    27 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

    • Draconic NEO@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      27 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).

    • cm0002@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      27 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
        0
        ·
        27 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
          0
          ·
          27 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
            0
            ·
            edit-2
            27 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
              0
              ·
              26 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

        • Draconic NEO@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          0
          ·
          27 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.

        • AVincentInSpace@pawb.social
          link
          fedilink
          English
          arrow-up
          0
          ·
          27 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
            0
            ·
            26 days ago

            I think that’s precisely whu 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
              0
              ·
              edit-2
              26 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…

  • Didros@beehaw.org
    link
    fedilink
    arrow-up
    0
    ·
    27 days ago

    I mean, you got like a 85% chance that anyone giving you software advice is, closer to 98% for hardware advice.

  • rumschlumpel@feddit.org
    link
    fedilink
    arrow-up
    0
    ·
    27 days ago

    I’ve been using the Firefox extension “Auto Tab Discard”, which helps a lot with RAM usage. I like multi-tab-browsing and IME browsers just don’t free up RAM when other applications need them.

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

      I tried that but I found that its effects on long term memory leakage weren’t adequate for me, and it still consumed way too much RAM. Which is why I just decided to limit RAM for Firefox. It achieves a similar effect as the browser unloads tabs when it runs low on memory, it just doesn’t wait until it’s using 31GB of RAM and instead just uses up to 8GB (which is what I capped it at) before unloading tabs.

    • hex@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      27 days ago

      wait so you just lose tabs you haven’t opened in X mins?

      i have a tab sleeping extension & generally throttle the ram with opera

      • rumschlumpel@feddit.org
        link
        fedilink
        arrow-up
        0
        ·
        27 days ago

        It might be a bit of a misnomer. The tabs aren’t deleted, just forcibly unloaded, and you can even prevent it from doing that on a per-tab-basis.

        • Norah - She/They@lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          0
          ·
          27 days ago

          Yeah so it just means the tab’s going to need to refresh when you click back to it. That seems perfect honestly, it’s already what most phone browsers do more aggressively. Cheers :)

  • arc@lemm.ee
    link
    fedilink
    arrow-up
    0
    ·
    26 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
      0
      ·
      26 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
        0
        ·
        25 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
          0
          ·
          25 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.

  • Infomatics90@lemmy.ca
    link
    fedilink
    English
    arrow-up
    0
    ·
    26 days ago

    Sorry, the only solution is the web aborting JavaScript. never going to happen. trust me, i stand with richard stallman when it comes to javascript.

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

      Disagreed, memory Limiting definitely helps with over-consumption. Can’t consume all the RAM when you only have access to 8GB of it.

        • Valmond@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          26 days ago

          Ah ok, totally fair IMO. Locked down languages just suck after their counterparts have moved forward (like c# or java).

          • Infomatics90@lemmy.ca
            link
            fedilink
            English
            arrow-up
            0
            ·
            26 days ago

            I mean, it depends on the type of person you are i guess. are you writing code for work? Or is it for yourself? I myself feel like i want to walk down the path richard walks down, and dump all this crap we use and run, and go 100% libre. It’s not like i have any friends and don’t really communicate with the outside world much other than in person with family or on places like lemmy.

            • Valmond@lemmy.world
              link
              fedilink
              arrow-up
              0
              ·
              26 days ago

              Hey, you do you, and chose the best language for you (and why did you chose C/C++ ? It’s so hard but powerful!) jk.

              Programming is great if you like that, I do, but you also need friends and stuff so don’t forget to touch grass from time to time! In the meantime we’re here on Lemmy :-)

              Cheers

      • Infomatics90@lemmy.ca
        link
        fedilink
        English
        arrow-up
        0
        ·
        26 days ago

        I will agree with you that VANILLA JavaScript isn’t to blame, but all the frameworks and packages are.

        • jatone@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          0
          ·
          edit-2
          26 days ago

          Yes, being shitty at their jobs. even the frameworks/packages are not to blame. its which you pick and how you use them.

          for peoples context: just checked a few sites most range in the 30MB-150MB per page. which is pretty reasonable for the complexity of the websites involved. one included a streaming service actively playing a video.

          Its just that these things add up across 100 tabs.

  • Daemon Silverstein@thelemmy.club
    link
    fedilink
    arrow-up
    0
    ·
    26 days ago

    One could also use w3m or links. All the RAM-hungry things (such as CSS3, JavaScript APIs and heavy multimedia files) will be finally gone for good.

  • Python@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    26 days ago

    I mostly use Firefox when I use a browser (App-using zoomer) but I actually might swap to something Chromium based at some point? My only reason for it is the resentment I’m building up for Firefox while writing Playwright tests at work. It takes like twice as long as chrome and keeps flaking due to random timeouts ughh