The feature is called Tab Unloading, and weirdly enough they made it not easy to access despite its usefulness.

You basically have to type about:unloads in the address bar and hit enter. If you then click on “Unload”, it will put the least used tabs to sleep. If you keep clicking that button until it’s greyed out, you’ll have unloaded all your tabs from memory.

This feature is handy if you want to temporarily switch to something that is memory hungry without having to close your 100 tabs.

  • boothin@artemis.camp
    link
    fedilink
    arrow-up
    111
    arrow-down
    2
    ·
    10 months ago

    Your Firefox should be doing this automatically when it detects the system needs more memory. You shouldn’t need to do it manually in almost any case

      • breakingcups@lemmy.world
        link
        fedilink
        arrow-up
        59
        arrow-down
        1
        ·
        10 months ago

        Your OS can’t decide when a tab is inactive though, given that they can run code, play media, etc. at arbitrary times.

        • lemmyvore@feddit.nl
          link
          fedilink
          English
          arrow-up
          17
          arrow-down
          2
          ·
          10 months ago

          Firefox can’t either, because pretty much any page today will have JavaScript running.

          The only way it works is to force tabs that haven’t been opened in some time to unload regardless of activity… but that’s something that the vast majority of users would not appreciate. For power users there are a ton of “tab unloader” add-ons that do this.

        • BlueKey@kbin.social
          link
          fedilink
          arrow-up
          3
          ·
          10 months ago

          maybe @Eggymatrix ment swapping.
          The OS tracks which memory-pages are used least and will swap them out when active programs need more ram than available.

      • Atemu@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        10 months ago

        Swapping anonymous pages is an extremely poor “solution” to cold memory. It’s the big hammer approach that technically always works but isn’t optimal for …anything really. That’s the best the kernel can easily and quickly know however which is why it’s done at all.

        It’d be much better if the process could shave off memory usage using its own domain knowledge. In the example of firefox, it’s much faster and less jarring to the user to have 10 tabs reloaded from the web (browser shows a spinner as usual, doesn’t lag) rather than swapped back in from disk (entire browser lags and it probably even takes longer).

        There’s no reliable mechanism to signal any of this to me knowledge however, so processes must guess the right time to do discard memory pre-emtively.

        • Eggymatrix@sh.itjust.works
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          10 months ago

          I believe you are mistaken, there is no way that reloading a tab from the web is faster than it being read from the disk.

          • Atemu@lemmy.ml
            link
            fedilink
            arrow-up
            2
            ·
            10 months ago

            For this you have to know that what gets swapped to disk is not the static content that you’d load upon opening a website, it’s the entire memory used by the tab.
            Static web content is usually kilobytes to megabytes and is also largely cached (on disk even). A tab’s memory usage OTOH ranges from dozens to hundreds of MB.
            Even a fast drive needs quite a long time (in computer terms) to load something like that, especially given that the access is likely not sequential and has a low queue depth.

      • julianwgs
        link
        fedilink
        arrow-up
        2
        ·
        10 months ago

        Edge does this very aggressively and I hate it… Also I believe that Chromium based browsers use more memory per tab, so that might be the reason why it feels more aggressive. Firefox does this very rarely.

    • Atemu@lemmy.ml
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      10 months ago

      Nope! Not happening or at least not soon enough. Neither on macOS or Linux (can’t speak for the stupid platform).

      Firefox will happily keep tabs open, even if macOS reports major memory pressure or Linux needs to invoke the OOM killer because it’s Gigabytes into swap.
      Not to speak of what happens before memory pressure is reached; Firefox will also happily use all of your memory even if you’d rather have it free for something else you’re going to do next.