llama.cpp with -ngl 99 still eats 5gb of system ram, where is it going llama.cpp
8B model, Q4_K_M, -ngl 99 so everything should be on the GPU. nvidia-smi says 6.9GB on the card, which matches what I expect.
But the process RSS is 5.4GB. On a 16GB box running two other things, that is the difference between fine and swapping, and it does swap - I can hear it.
If all the layers are on the GPU, what is holding 5GB of host memory?
@muslin_mira · 3mo ago · 2 replies
Most of it is not really "used". The model file is memory-mapped, so the pages you have read count towards RSS but they are page cache backed by the file on disk - the kernel will drop them the instant something else needs the memory. A 4.7GB GGUF that has been fully read shows up as roughly 4.7GB of RSS and costs you almost nothing.
Prove it to yourself: run with
--no-mmapand watch RSS become genuinely smaller after load, while startup gets slower. Or look at PSS instead of RSS -smem -k -P llamawill show you a much more honest number.If it is actually swapping, that is a separate problem and it is usually the other two things on the box, not this.
Reply
Report
@keg_line_ken · 3mo ago
PSS is 1.1GB. So I have been reading the wrong column for about a year. The swapping is a Postgres container with no memory limit, which is embarrassing but at least it is fixable.
Reply
Report