Originally posted by syg00
That would be precisely my definition. Could probably be (more logically) expressed as "VIRT = RES + SWAP".
What have dirty pages got to do with the swap discussion - if they are dirty they are "pinned" in physical memory, and so are included in the resident count.
If they are anonymous, and have been swapped out, they are in the SWAP count - and increase the VIRT size accordingly.
I haven't looked specifically at the code for this, but seems logical to me.
well lets see,
(gary) ~ $ free
total used free shared buffers cached
Mem: 1033040 253984 779056 0 15224 131248
-/+ buffers/cache: 107512 925528
Swap: 2096472 0 2096472
so 0 swap used and still 2/3 of my physical RAM unused
so lets look at what you said for startx
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND
1006 gary 17 0 4684 1320 4224 S 0.0 0.1 0:00.00 3364 startx
3364 SWAP used by startx
with 0 swap actually used and lots of physical RAM free
it seems rather obvious that all the virtual memory is not in either swap or resident
but is "virtual" duhhhh.
and clean anonymous pages under memory pressure just get ejected not written to swap because they contain nothing at all so dirty has something to do with it.