Patches for check_mem.pl swaps used and free memory [sf#1527980] [#787]