I'm trying to understand what happens when a Linux system runs critically low on RAM. Since the desktop environment is made up of user-space processes, would the kernel ever forcibly terminate KDE, GNOME, or the entire graphical session to keep the system alive, or would it normally kill individual applications instead? I'm testing a Red Hat-based system with KDE accessed through xRDP. Occasionally the session freezes on a single frame, and someone at the office has to restart the machine. I'm wondering whether the kernel's out-of-memory handling might be killing part of the desktop, or whether another problem is more likely. I don't currently have root access or reliable SSH access, so recovery options are limited. Ideally, I'd like to identify the cause before wider deployment and find a way to recover remotely without involving someone physically at the computer.
3 Answers
A memory shortage can make Linux appear hung for a long time before anything is killed, especially if it is constantly swapping. The freeze may also be caused by a graphics, xRDP, display-server, driver, or application problem rather than RAM exhaustion. If possible, check memory and swap usage during or immediately after the incident, and inspect system logs for out-of-memory messages once the machine is reachable again.
For systems you control, services such as earlyoom or systemd-oomd can react to severe memory pressure sooner than the default behavior, and cgroups can limit a test application without starving the entire desktop. Since you lack administrative access, ask whoever manages the machine to check those settings, collect logs, and provide a recovery method such as a watchdog or remote management hardware. Keeping a separate administrative connection available is also useful when the graphical session fails.
Running out of memory does not automatically mean a kernel panic or that the whole desktop will be shut down. The kernel’s out-of-memory handler usually selects one or more user-space processes to terminate, often a large application such as a browser or editor. If the graphical shell, display server, or an important xRDP component is selected, the session can appear to freeze or disappear, but that is different from the kernel deliberately shutting down the entire desktop environment.

A program can also crash simply because it failed to handle a memory-allocation error. The kernel panic question is separate; most memory pressure problems affect an individual process rather than the kernel itself.