Question: I have an ubuntu vps running that has about 300MB of memory, of which only 20% or less is free right now ...  

My question is, how can I figure out what particular program I'm running that is causing it to swap so much?

Answer: 
To find out the amount of swap space used by every process, run `top` (not `htop`), press 'f' to select columns (f for fields) to display, press 'p' to add swap to display, press 'o' to sort the table (o for order by) and press 'p' again to order by swap usage.
[smem](http://www.selenic.com/smem/) is a bit harder to use than top, but offers good information. You could start with with `sudo smem -s uss -r -k` which will output:

```
  PID User     Command                         Swap      USS      PSS      RSS 
12345 spam     /usr/lib/jvm/java-6-sun/bin        0   620.9M        0   626.5M 
98765 eggs     /usr/bin/java -Xmx1500m -XX        0   544.2M        0   549.9M 

```

You might also want to check out [this lwn.net article](http://lwn.net/Articles/329458/), which explains the difference between RSS, PSS and USS.