← all posts site ↗

why my desktop ran out of memory and died

the desktop crashed again and this time i actually found out why instead of blaming the compositor. ram hit thirty point nine out of thirty point nine gigabytes and swap hit twenty eight point two out of thirty point nine in a matter of seconds. not a slow leak. a fast spike with no escape valve. a watchdog called oomd saw swap above ninety percent and killed the biggest group it could find, which happened to be the whole desktop session. twelve hundred and seventy one processes died at once. that was the crash.

three things were wrong. first, swap lived inside ram. it was zram, which stores compressed pages in memory itself, so making room cost more ram. pushing the kernel to swap out was like asking the building to collapse in order to make an exit. second, a local ai service that keeps a ten gigabyte model hot had no cap and no isolation, and after it crashed something restarted it from a terminal, which landed it inside the desktop's own group. a six minute voice transcription made its helper grab more scratch memory with every file and never give it back, climbing from sixty eight megabytes to over one and a half gigabytes in a row. third, nothing was sampling memory fast enough to see it coming.

the fix was structural. real disk swap: a ten gigabyte swapfile plus a smaller zram, seventeen point seven total, with zram kept at priority one hundred so it still gets used first. the ai service moved into its own systemd scope with an eighteen gigabyte cap and a five gigabyte swap cap, so if it misbehaves oomd kills it alone and the desktop survives. and a sampler now logs the top six memory groups every two seconds into a rotating file, so next time there will be a trail instead of a mystery.