This question already has an answer here:
I am having trouble running e2fsck due to memory limitations, as detailed in this question. In the course of investigating that, I came upon something that may be of more general interest, so I will put it in its own question.
While running e2fsck, memory usage on the machine goes to around 99%. There also starts to be some swapping. What is odd, however, is that this is the start of the output of
top - 14:09:37 up 1 day, 4:14, 3 users, load average: 1.00, 1.00, 0.92 Tasks: 127 total, 2 running, 125 sleeping, 0 stopped, 0 zombie Cpu(s): 12.4%us, 1.8%sy, 0.0%ni, 81.1%id, 4.6%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 1004.961M total, 987.484M used, 17.477M free, 664.469M buffers Swap: 21.953G total, 72.574M used, 21.882G free, 68.512M cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 7627 root 20 0 164m 152m 61m R 100.0 15.2 49:18.25 e2fsck 8340 root 20 0 2696 996 752 R 2.0 0.1 0:00.01 top 1 root 20 0 2896 8 4 S 0.0 0.0 0:01.87 init
So even though overall memory usage is at 99%, e2fsck is only showing as using 15.2%, and there are no other memory hogs running.
Where did all the memory go? Is this behavior unique to e2fsck, or is this "normal" (not desirable, but understandable). I don't know how memory can be used by anything other than a running process.