In order to avoid the problem epxlaind in the post http://www.javablog.fr/java-outofmemoryerror-and-memory-checker.html, there is an useful unix command free -tm:

The values ​​are in MB, Mem is the actual RAM, Swap (specific to Unix) only serves to supplement the RAM (That is the ROM which serves RAM when needed).

myAccount@javablogServer:~> free -tm
total used free shared buffers cached
Mem: 2011 1783 228 0 43 1658
-/+ buffers/cache: 80 1930
Swap: 1023 36 987
Total: 3035 1819 1215

Best regards,