I remember, back from my days with Windows Vista/7, that there was a tool called memclear or memclean that would free some memory by invoking the NT garbage collection API. Probably it cleared cache too. Very often when I use Ubuntu, after a while the system stays at a couple of gigabytes allocated memory, and when I perform memory-intensive tasks such as image editing, I have to wait quite a while for the extra gigabytes to swap.

Is there a way to force something like a kernel GC to free memory that really isn't used? (when I start up, memory consumption is less than a gigabyte)

  • 1
    The way to free memory is to close the programs that are using it. Dropping buffers and caches (memory that "isn't used") doesn't help you. – Michael Homer Nov 18 '15 at 6:12
  • (Except in fairly rare cases that it doesn't sound like you're in). – Michael Homer Nov 18 '15 at 6:14

From what you have posted it doesn't seems like you under stand how memory works in Linux.

I recommend reading

The jist of those sites is that you have more "free" ram then you think.

| improve this answer | |

If it is a virtual machine, you can do

echo 1 > /proc/sys/vm/drop_caches

This way, for instance, in vmware with memory ballooning (i.e. vmware-tools or open-vmware-tools installed), you return the current memory used in caches to the virtualisation hypervisor.

As others say, this is only useful in very specific conditions.

| improve this answer | |

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