this post was submitted on 09 Dec 2025
760 points (98.2% liked)

Technology

77096 readers
2576 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related news or articles.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


founded 2 years ago
MODERATORS
 
  • 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
you are viewing a single comment's thread
view the rest of the comments
[โ€“] tal@lemmy.today 9 points 3 days ago* (last edited 3 days ago) (1 children)

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.

I guess the key is it has to be the same version of electron in the back end. If they change too much of it then how much memory can be shared?