https://bugs.kde.org/show_bug.cgi?id=241032

--- Comment #8 from Igor Kushnir <igor...@gmail.com> ---
(In reply to Jack Hill from comment #6)
> I also suffer from this problem. For me KDevelop often uses so much memory
> that my PC stops responding.
> 
> This is a major issue for me since my laptop only has 7.7GiB. It is normal
> for me to have KDevelop, Firefox, KMail, NeoChat all open whilst compiling
> at the same time and unfortunately I can no longer use KDevelop because of
> this.
8 GB of is a very low amount of RAM for a modern development setup. I had been
hit by this issue hard before, because my computer has only 16 GB of RAM.
Following guides like https://wiki.archlinux.org/title/Swap#Performance, I set
vm.swappiness=1 and vm.vfs_cache_pressure=50 in /etc/sysctl.d/99-sysctl.conf,
which made the slowdown very sudden and intense when my system run out of RAM.
My current solution is to put the highest-priority swap partition on an SSD.
This way, when RAM is exhausted, the slowdown is not nearly as extreme as when
swapping to an HDD. Increasing vm.swappiness can make the RAM-exhaustion
slowdown much more gradual even without an SSD, at the cost of negative impact
on normal performance.

Apart from restarting KDevelop when it consumes a lot of RAM, another way to
reduce RAM usage is to set KDevelop's or KDevelop-libclang's temporary
directory to a location on disk rather than in /tmp (which is usually on a
tmpfs). That's because libclang writes large files named preamble-*.pch into
the temporary directory. You can set one of the temporary directory environment
variables supported by libclang (see
https://github.com/llvm/llvm-project/blob/b6b492880f5ac6357d85ba2f3ad8e41fded1d97c/llvm/lib/Support/Unix/Path.inc#L1435
for Unix-like systems). For example, run KDevelop as
`TEMPDIR=/path/to/an/hdd/dir kdevelop`. Starting with LLVM 17, you'd also have
to configure KDevelop not to place the preamble files into RAM (see the
screenshots in https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/283).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to