title: VSZ vs RSS memory and swap space
body: <p>I am trying to understand the memory usage of a large scale simulation that we are trying to run. When I run it "ps" reports </p>
  
  <pre><code>USER    PID %CPU %MEM     VSZ    RSS TTY    STAT START   TIME COMMAND
  myuser 5252 97.7  0.5 5751412 377392 ?      Rs   19:49   1:15 myprogram
  </code></pre>
  
  <p>We have three arrays in that simulation that each occupy 1.6gb (200 million doubles). Based on the information in </p>
  
  <p><a href="https://stackoverflow.com/questions/7880784/what-is-rss-and-vsz-in-linux-memory-management">What is RSS and VSZ in Linux memory management</a></p>
  
  <p>I expected that memory to be listed under RSS, but RSS is only 377MB. Based on the information in the stackoverflow thread I concluded that the memory must be swapped out and looked at "free -m"</p>
  
  <pre><code>             total       used       free     shared    buffers     cached
  Mem:         64391       5985      58406          0        463       1295
  -/+ buffers/cache:       4226      60164
  Swap:         4766          0       4766
  </code></pre>
  
  <p>and swap is not used at all! Aside from the fact that it is too small anyway. So where is this difference in RSS vs VSZ coming from? Why are the arrays that we allocate part of VSZ and not part of RSS?</p>
  
  <p>I appreciate all help</p>