• Windows Latest discovered Discord and other Chromium and Electron-based applications with high RAM usage
  • RAM usage spikes from 1GB to 4GB on Discord both in and out of voice chat
  • _cryptagion [he/him]@anarchist.nexus
    link
    fedilink
    English
    arrow-up
    121
    ·
    1 day ago

    I really wish Electron wasn’t as popular as it is. It’s such a fucking memory hog. I mean, sure, I’ve got RAM to spare, but I shouldn’t need that much for a single app.

    • cmnybo@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      54
      ·
      1 day ago

      Yes, it runs a separate browser instance for each electron program. Many of the programs that use it could just be a PWA instead.

      • lastweakness@lemmy.world
        link
        fedilink
        English
        arrow-up
        46
        ·
        1 day ago

        This is what bothers me so much… Browsers should be improving their PWA implementation (looking at you, Firefox) and electron apps should be PWAs more often. Another decent middle ground Is Tauri. SilverBullet and Yaak are both so much lighter and better than anything else on my system.

        • Pechente@feddit.org
          link
          fedilink
          English
          arrow-up
          36
          ·
          edit-2
          24 hours ago

          Yeah but companies want full control and no ad blockers. That’s why they’re pushing shoddy Electron apps over their web experiences and PWAs.

      • tal@lemmy.today
        link
        fedilink
        English
        arrow-up
        9
        ·
        edit-2
        22 hours ago

        I wonder how much exact duplication each process has?

        https://www.kernel.org/doc/html/latest/admin-guide/mm/ksm.html

        Kernel Samepage Merging

        KSM is a memory-saving de-duplication feature, enabled by CONFIG_KSM=y, added to the Linux kernel in 2.6.32. See mm/ksm.c for its implementation, and http://lwn.net/Articles/306704/ and https://lwn.net/Articles/330589/

        KSM was originally developed for use with KVM (where it was known as Kernel Shared Memory), to fit more virtual machines into physical memory, by sharing the data common between them. But it can be useful to any application which generates many instances of the same data.

        The KSM daemon ksmd periodically scans those areas of user memory which have been registered with it, looking for pages of identical content which can be replaced by a single write-protected page (which is automatically copied if a process later wants to update its content). The amount of pages that KSM daemon scans in a single pass and the time between the passes are configured using sysfs interface

        KSM only operates on those areas of address space which an application has advised to be likely candidates for merging, by using the madvise(2) system call:

        int madvise(addr, length, MADV_MERGEABLE)
        

        One imagines that one could maybe make a library interposer to induce use of that.

      • plz1@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        ·
        1 day ago

        I tried the PWA route with Discord. It wouldn’t stay logged in, and acted generally janky. That said, I do PWA with any app that’s Electron, at least to try and avoid the RAM bloat.

    • modular950@lemmy.zip
      link
      fedilink
      English
      arrow-up
      9
      ·
      1 day ago

      maybe a toggle to choose between “take some extra RAM, I’m feeling generous” and “fuck you, I’m computing shit over here” could be used to let the app know your current mood / needs …

      • TheBlackLounge@lemmy.zip
        link
        fedilink
        English
        arrow-up
        10
        ·
        edit-2
        21 hours ago

        Memory hogging browsers usually do release memory when pressured. You can take it further by getting extensions that unload unused tabs.

        The problem is electron apps that load the whole browser core over and over.