Alternatives to purge command

memory

I read in a different thread (How to specify command to always run as root?) that using the purge command in Terminal to free memory is not a good idea. Does anyone know an alternative way to do this without installing third-party software? This is a curiosity based question, I don't mind if it's a complicated process, because I already have third-party software to clean memory. Thanks.

EDIT (maybe I wasn't clear in my question):
Sometimes I want to speed up my Mac because too much memory is being used (for example immediately after closing a memory-consuming app). The question is: how would I quickly clean and retrieve memory to give to other tasks? Do I have to wait for the computer itself to do this or can I also do it manually?

Best Answer

The problem is with clearing inactive memory in the first place, regardless of which command is used to do it.


Indeed, using purge is "not a good idea" but the problem is due to what the end result of the command is rather than how the command does it or other specific problem due to the command.

Running purge attempts to clear inactive memory. An 'alternative' command would not be any better than running purge, providing it does the same thing.

This excellent answer explains the reasoning behind inactive memory in more detail: