I am running two Ubuntu 12.04
servers (no GUI / desktop) using canonical's cloud images on Amazon EC2
. One is a micro
with 613MB
of RAM and one is a medium with 3.75GB
of RAM.
I only have opscode's chef installed on the micro
box, and on the large box I have a java app / SOLR index initialized with 2048MB of ram:
JAVA_OPTIONS="-server -Xms2048m -Xmx2048m -XX:+UseParallelGC -XX:NewRatio=5"
If I have had chef
running on the micro box for a while, and then try and install a new program, or start up something like the RabbitMQ
or Apache2
I will get an error about not having enough free memory to complete the operation.
On the large box, it seems that the Java application will periodically crash when the memory gets low, or after the box has been on for a while.
Using the free
/ free -m
command I see there is in fact not much memory available, at which point I usually have to reboot the system to "clear out" the memory.
It seems to be that either the memory should be automatically freed or "cleared" after some point of time, or if it must be done manually there might be a better way to free up / clean/ manage the memory more efficiently.
Is there a way I can manually free up / clear the system's memory? Is there a tool that will check / clean the memory automatically?