Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

OSX has a pretty cool tool called purge.
You run it at the command line and it frees up all available memory - slowing your system to a halt in the process.
I often free up 2GB of memory or more after running it.
Is this available for Debian/Ubuntu?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Try

sync; echo 3 > /proc/sys/vm/drop_caches

Edited 8/19/12 to add explanation on drop_caches:

Explanation on drop_caches

Since Kernel 2.6.16, you can control how cache behaves, there are four possible “positions” for the switch.

0 -> Will give the Kernel full control to the cache memory 1 -> Will free the page cache 2 -> Will free dentries and inodes 3 -> Will free dentries and inodes as well as page cache

So, just enter those values to the file /proc/sys/vm/drop_caches, with echo, and as root:

sync; echo 0 > /proc/sys/vm/drop_caches

or

sync; echo 1 > /proc/sys/vm/drop_caches

or

sync; echo 2 > /proc/sys/vm/drop_caches

or

sync; echo 3 > /proc/sys/vm/drop_caches
share|improve this answer
    
Could you explain what's happening here? –  pferdefleisch Aug 19 '12 at 15:47
    
I've edited my answer to include an explanation on drop_caches. –  superuser Aug 19 '12 at 17:02
    
The OSX command is temporary. This seems permanent? Is it? Is there a more temporary solution? –  pferdefleisch Aug 22 '12 at 20:23

Try

free && sync && echo 3 > /proc/sys/vm/drop_caches && free
share|improve this answer
    
The OP is asking about purging memory, not installed packages. –  terdon Aug 19 '12 at 3:43
1  
Thanks for the edit, downvote removed :) –  terdon Aug 20 '12 at 3:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.