My system is heating up
A small note on that. If you could live with the compilation speed but it's annoying to have the CPU fans working all the time, you could address it by moving the CPU to a more power-efficient mode. Though that will only slow things down for you, and you're saying it's already slow and you're running out of RAM, so maybe heat/fans are not your biggest concern.
Personally, I currently use intel CPUs. Old ones I could undervolt AND limit in watts, making them silent and reducing power usage by a third at the cost of ~5% performance. My current one doesn't support undervolting sadly, and the options for wattage limits are also almost fully gone. What I use now is:
/etc/tmpfiles.d/cpu-prefer-powersafe.conf
# Possible values: default performance balance_performance balance_power power
w /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor - - - - powersave
Replacing "powersave" with "power" cuts the energy usage by half and makes the CPU fully silent at ~50 degrees... at the cost of 30% performance on this new CPU :(( Or keeping it as above, energy usage goes down somewhat (haven't measured precisely), CPU mostly silent at 50-60 degrees, performance down by 15%.
OK probably I wrote waay too much 😅