# i asked for 512K of context × 4 slots on 80gb of ram, and the whole machine froze

at first i blamed a dead wifi dongle, but it was the ram: the session cache at 512K needed ~23gb more on top of a 40gb model that was already taking up the space, and a simple memory cap would have avoided it all

- date: 2026-10-19
- type: experiment (crashes)
- hardware: 3090 + 3080 Ti, 80gb
- source: measurements made by the author on his own hardware
- html page: https://pkillsleep.dev/en/labo/512k-machine-figee/

## what happened

after seeing that long context worked well, i got greedy and configured four slots of 512K. the machine froze dead, and from the outside it looked exactly like a network outage: nothing answered remotely anymore, to the point that i first suspected the wifi dongle.

[meme: Stressed Mekhi Phifer Smoking]

## the real cause

reading the logs after rebooting, the last kernel line before the freeze was an "under memory pressure, flushing caches", and there was no wifi error at all. the math then explained everything: each session costs about 1.16gb of cache per 131K tokens, so four slots plus the main session at 512K needed around 23gb, on top of a model that already took about forty. the machine started swapping until it couldn't do anything anymore.

## the fix

i put a memory cap on the service (`MemoryMax=72G` in systemd), so that next time it's the engine that gets killed, not the whole machine. then i went back to two slots at 262K, then [two slots at 400K](/en/labo/400k-contexte-80go/), with a peak at ~70gb.

## what i keep

a machine that swaps to death looks like a network outage, so before blaming the wifi, look at the ram. and the context × slots math gets done before touching anything else, it takes three lines and saves you a forced reboot.

## What these numbers don&#39;t tell you

- the exact peak at 512K × 4 was never observed, the machine froze before it could write it down: the 23gb are calculated from the measured size per session

