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.

If I run a free -m, I get this output:

Free -m output

Is there a command that I could use to clear the used memory? I have tried this:

echo 1 > /proc/sys/vm/drop_caches

It will ask for sudo. But even after sudo, it gives bad command error.

Here is the link where I got to know about drop_caches.

I am just looking for a way on how to clear the cache.

share|improve this question
    
Off topic. Belongs to superuser. Voting to close. –  Macmade Sep 2 '12 at 3:33
    
Why are you asking?? It is usually not worth the effort! –  Basile Starynkevitch Sep 2 '12 at 7:42
    
I want to test the performance of an application , which initiates several processes , and generate some statistics , If i run the same application for two times the statistics will not be accurate , and also clear understanding of how the application behaves in each of scenarios , will remain as a mystery . If cache is the matter for its performance , I definitely need to know if there is any way there to clear the cache so that I can take care of it . I am really sorry , If this stack overflow is not a platform to ask such system level questions . –  aravind.udayashankara Sep 2 '12 at 16:43
add comment

migrated from stackoverflow.com Sep 5 '12 at 3:30

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 5 down vote accepted

Try this as root (not sudo):

#sync && echo 3 > /proc/sys/vm/drop_caches
share|improve this answer
add comment

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.