How does the 'memory clean' app work

7,214

You do not want to "clean" your memory. This usually involves dumping the disk cache, which is very bad for system performance. The purge command is provided as a part of Apple's developer tools for debugging, testing, and dealing with specific issues that are related to performance-testing as if a system was freshly booted. This will considerably slow down your system.

In general, you want almost 0 free memory - any memory not being used by active applications should be in the "inactive" pool, which means that it's 100% available if an application needs it, but it is actively being used by the system to accelerate your harddrive.

Every time you access a file on your harddrive, if there is enough free memory, OS X (and Windows, and Linux) will copy the file into inactive memory. This way, if something tries to read the file again, it will read it from RAM and not from your harddrive, which can be several thousand times faster. There are many system files which are read very frequently, and disk caching is critical for system performance because of this.

Share:
7,214

Related videos on Youtube

sam
Author by

sam

Updated on September 18, 2022

Comments

  • sam
    sam almost 2 years

    I use the command line command purge to clean my memory for time to time when my machines running slow and i dont have the time to close down the machine, or close down key programs.

    I was trying to show it to someone whos less technical, but as you can imagine the command line is very daunting, even if it is only one command.

    I then came across this app on the mac app store called MEMORY CLEAN i guessed it was just a gui interface that ran a purge command, but upon running it it seems to clean the unused memory in a different way, which dosnt cause the hole system to freeze.

    How does it do this ?

    • David Schwartz
      David Schwartz over 10 years
      Memory does not get dirty and does not need cleaning. Memory cleaners just increase the amount of memory that is wasted. Think about it -- free memory has no effect on performance until it is used. So to get any benefit from a memory cleaner, the system has to take the memory it made free and make it used again. In other words, for a memory cleaner to help your system, the system must first undo the work the memory cleaner did. Duh!
  • user1984103
    user1984103 over 10 years
    @FiascoLabs Sadly they are not just placebos. On mobile devices, they flush inactive applications from memory, and on desktop OSes they flush the disk cache. It gives a great big "free memory" number, but terrible performance.
  • Fiasco Labs
    Fiasco Labs over 10 years
    Heh, so their effect got worse over time. Windows 95 was, due to a 64k stack, in need of a certain part needing flushed to not crash. Memory cleaners became a lucrative bandwagon that Windows 2000 and XP did not need. Every so often we get the big Linux Panic from the crossovers. *nix always believed that empty memory was wasted memory and with due reason.
  • sam
    sam over 10 years
    Is it not still relevant for programs the leak memory ?
  • user1984103
    user1984103 over 10 years
    @sam This is completely unrelated to memory leaks. It has never been relevant for memory leaks, because the whole reason you can't clean those is because an application is saying that the leaked memory is still in use, and there's no way to know otherwise until that application is closed, at which point the OS automatically frees up all of the memory used by the application anyways.