问题
Does the virtual memory of a process ever shrink?. Does the swap size of the process reduce?
回答1:
Virtual memory, today with tons of dirty cheap RAM, is used more for memory protection than for swapping on PC.
So there is no 1:1 correlation between used swap and virtual memory.
And with 64bits addresses there is no need for the OS to claim back unused virtual memory pages. It'll do it if it needs to.
If by swap size, you mean the swap column in top
, that's not used swap, but the required swap space to swap in/out the process.
来源:https://stackoverflow.com/questions/36396831/does-the-virtual-memory-of-a-process-ever-shrink