To free up some memory claimed by pagefile, dentries and inodes. Pagefile is virtual memory. Dentries and inodes are used for your hard drive files. This should work on any Debian based Linux.
First we want to check the memory with free -m, then run:
# sync
Sync command will flush the buffer to the hard drive. And also force the pending disk writes to complete.
Might need to sudo su (on Ubuntu to be able to run the next command)
# echo 3 > /proc/sys/vm/drop_caches
This command will free up the pagefile, dentries and inodes.
Run free -m again to check your free memory.
Happy freedom!