• Badabinski@kbin.earth
    link
    fedilink
    arrow-up
    13
    ·
    9 hours 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
      5
      ·
      edit-2
      9 hours 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.