7

After the system has been running for 8 hours continuously, it becomes slow. When I faced the same situation on Windows, I used CCleaner to clean memory, which used to give me a little boost.

Is there any application or command that cleans the unused existing RAM memory (browsers, temp files, prefetch operating system files, etc.) like CCleaner does in Windows?

  • 'prefetch' is Windows specific, by the way - you need to be more specific on what exactly you want cleaned. (As well, CCleaner doesn't actually clean all the files up... not from a forensic examination point of view) – Thomas Ward Feb 11 '15 at 4:54
  • sorry @ThomasW. for the unclear question from earlier. Now I had more details to the question, please let me know if there is a way to speed up the system – mateen Feb 11 '15 at 4:58
  • @ThomasW. According to description on piriform.com/ccleaner CCleaner does actually clean all the files up. – mateen Feb 11 '15 at 5:02
  • I have looked at a drive which had CCleaner run - not all things get purged. And I am talking about examination with heavy forensics tools, not typical tools. – Thomas Ward Feb 11 '15 at 12:34
  • Thanks for your valuable suggestion,but I just wanted some tool which could clean up the unused memory. below is the answer please refer to it – mateen Feb 12 '15 at 4:53
5

"Memory" and "temporary files" are different things.

Memory is normally RAM. Linux manages its RAM automatically, no cleaning needed; if there is some process misbehaving and using too much RAM, you just stop it. Browsers are classical offenders there; I need to close mine (and restart) every couple of weeks. Gnome-shell is another well-known memory leaker.

For the file part, you can install Ubuntu Tweak and use the janitor module:

Ubuntu Tweak Janitor

See also How safe is Ubuntu tweak's Janitor?. You can also install it using a PPA, look here in WebUpd8 (it's still ok for 14.04).

Consider anyway that if you clear a cache, the data will need to be reloaded/rebuilt, so the effect is, most of the time, to slow things down(1). For example, clearing the nautilus thumbnails means they are to be rebuilt again --- slowing down file browsing.

(1) the only exception here is the apt-cache and the old kernels --- in normal condition, on desktop, they are almost always just lost space.

If your system is really slowing down a "rogue" or leaking application is the most common reason. Try to catch it with top or similar tools, and if you find it, post a more specific question or a bug report.

9

1 Foreword

It's a bit strange that your system gets sightly slower after 8 hours. Since you also face the same problem on windows I guess this may be a hardware issue.

Without more information it is hard to say, but if you are lucky a RAM upgrade may help. If not, you maybe have to face a bigger hardware problem in the future.

2 Definitions and Distictions

RAM, temp-files, system-files and prefetch are different things.

  • On Linux systems you don't need RAM cleaners.

    If a process uses "too much" RAM stop and restart it. Such memory-leaking programs are often browsers and browser plug-ins. I also saw X.org misbehaving sometimes.

  • Temporary files only use some storage. So they won't slow down your system.

  • There is a reason why they are called system files. Most of them are used to run your system and programs like you are used to it. So if you don't know what you are doing, don't mess around with them!

  • Prefetching is Windows-specific. The Linux or Ubuntu equivalent is called (u)readahead.

    You don't have to think about it on Linux systems.

3 Software Recommendations

  • I recommend BleachBit: It's a good file-cleaner and (also in root-mode) you can hardly mess up your system.

    To install it open your terminal and type

    sudo apt-get update
    sudo apt-get install bleachbit
    

    type your password (no characters will be displayed) and wait till executed.

  • Till Ubuntu 12.04 you can use computer-janitor: But if you don't know what you are doing be careful. You may destroy your system!

    To install it open your terminal and type

    sudo apt-get update
    sudo apt-get install computer-janitor-gtk
    

    type your password (no characters will be displayed) and wait till executed.

  • Until Ubuntu 14.04 you can use Ubuntu Tweak: It has computer-janitor built in and many other more or less useful utilities. But as said before, be careful!

    To install it open your terminal and type

    sudo add-apt-repository ppa:tualatrix/ppa
    sudo apt-get update
    sudo apt-get install ubuntu-tweak
    

    type your password (no characters will be displayed) and wait till executed.

  • waow you look like professional in linux thanks for the information, Ubuntu tweak is the tool what I needed, and there's one thing I want to ask as you mentioned in your answer what is memory leakages and why do they occur ? – mateen Feb 12 '15 at 4:57
  • 1
    well, i think i'm only an interested advanced user... but that's not the point! ;-) memory leaks occur when a programs RAM-management is unclean (programming-issues, no garbage collection, etc.) or incorrect (other bugs, etc.). they are no longer needed parts of RAM but they also aren't released, so no other program can use this parts of RAM! – DJCrashdummy Feb 12 '15 at 13:11
4

You can free memory without installing more software by writing to the drop_caches file in the /proc/sys/vm directory.

First you will want to use a program like top or free to view the RAM usage and availability:

$ free -m
             total       used       free     shared    buffers     cached
Mem:         31730      31118        611      16606         57      25018
-/+ buffers/cache:       6042      25687
Swap:        32313          0      32313

Next you will need to execute the following command:

sudo sysctl vm.drop_caches=3

(which is roughly equivalent to the slightly more cumbersome sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'.)

Then run the free command and review the output:

$ free -m
             total       used       free     shared    buffers     cached
Mem:         31730       6224      25505        121          2        518
-/+ buffers/cache:       5702      26027
Swap:        32313          0      32313

Below are links to article that identify the process and documentation regarding the use of the drop_caches file.


Sources and further reading:

  • I ran echo 3 > /proc/sys/vm/drop_caches as root and it did the trick. – amit_kumar Oct 21 '16 at 8:31
2

BleachBit from the Ubuntu Software Centre is also a useful consideration. It deletes unnecesssary files to free valuable disk space, maintain privacy and remove junk amongst other things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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