Alt account of @Badabinski

Just a sweaty nerd interested in software, home automation, emotional issues, and polite discourse about all of the above.

  • 0 Posts
  • 3 Comments
Joined 6 months ago
cake
Cake day: June 9th, 2024

help-circle
  • 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).


  • Badabinski@kbin.earthto196@lemmy.blahaj.zonefirefox rule
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    24 hours 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).


  • 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.