r/archlinux • u/Adorable-Beautiful52 • 23d ago
SUPPORT arch memory issues
when arch runs out of memory, it heavily lags for multiple minutes before the kernel terminates a program to clean up memory to the point where you are just sitting there. this happens frequently when using intellij idea; how do I make it quicker to just terminate the program when it runs out of memory so it's not lagging for 5 minutes before it finally terminates a program? the lag is so heavy that I can't close anything myself.
0
Upvotes
11
u/soking11 23d ago
Do you have swap memory assigned?
9
u/iAmHidingHere 23d ago
https://wiki.archlinux.org/title/Improving_performance#Improving_system_responsiveness_under_low-memory_conditions
6
u/Suspicious_Punk84 23d ago
Do you really want your system killing your apps randomly? Use a swap file.
4
u/East-Yogurtcloset272 23d ago
Create a swap file or swap partition. Wiki will guide you to how much in relation to your workload / RAM.
Then you can alert yourself to close things down.
I'm not aware of a brutal kill setting when memory is running low/out.
3
u/ThePowerOfPinkChicks 23d ago
I’ve read my coffee grounds. They tell me: Don’t blame Arch, but your unsuitable configuration.
1
u/Zandegok 23d ago
Do you have swap and zram configured? They are the first barrier for preventing RAM accumulation.
You should look into memory control. There are countless ways to limit, how much an app is allowed to allocate.
And if you find yourself on an already frozen screen there is Alt+Sysrq (prtscr) that conbined with REISUB keys consequtively should temporarily solve your problem. Not recommended to do it often, since programs won't do their shudding down routines
1
u/[deleted] 23d ago
Ultimately more ram is better but 1gig of zram and a few gigs of swap helps. If you go too big on the zram, you’ll have diminished returns. Don’t forget to configure priorities so the zram is used first
1
u/BlueGoliath 23d ago
Unused RAM is wasted RAM. /s
1
u/BanaTibor 23d ago
I assume you are doing Java development in Intellij.
Is it Intellij which eats up the memory or your developed software when you run it from intellij? So why do you let Java programs run out of memory?
I suggest you to prevent this issue by limiting the memory each jvm can use. For intellij there is a config file: HOME/.config/JetBrains/XXX/idea64.vmoptions, and you can pass the Xmx parameter to jvm when you run a program -DXmx=256M for example. With this you can limit the memory usage and your program will die with OutOfMemory error instead waiting for the oom killer to kill it.
1
u/Objective-Stranger99 22d ago
Try zswap + earlyoom
1
u/PhrancesTheMute 22d ago
ZSWAP is your friend and to a lesser extent ZRAM.
1
u/archover 22d ago
Give
$ free -mto resolve ambiguity.Good day.