I needed to free some garbage in my ram due to my bad coded OpenGL experiments and their memory leaks. So I found this technique which freed about 1.2GB of my RAM:
# Generate a 2000MB file
dd if=/dev/zero of=junk bs=10MB count=200
# by now top will show not much free memory left.
rm junk
If you would have coded your OpenGL apps better you wouldn’t need that command .
However a good idea is to use cron and make it run that command every 10 minutes or so. :p
Yes Adam. It might be a good idea. However, if it is done when the system is under heavy load you will rape the system apart.
Because this command fills your memory then empties it. If you memory usage is already high it will probably use swap, which is slow! But things should come back to normal after `rm junk` is done.