I had a java application that runs as a daemon process. Initially, I discovered that after about a week, the applicaiton would throw an out of memory error. I researching, I discovered that I could manage the memory and avoid the problem by setting the -Xms and -Xmx flags at startup to specify how much memory the application would have. This ultimately resolved my memory problem.
However, later on, I discovered that the application was causing performance issues on some machines that only had 1GB of memory, 1GB of memory was how much I had allocated for -Xmx. So the java application took all of available memory.
So using jconsole, I was about to determine that the application ran at about 150mb. So using that information, I dropped the -Xmx value to 300mb. Thinking that it would be plenty. But then I discovered that the application was only using about 15mb. Why? Why does the application use 150mb when its allocated 1GB, but only 15mb when its allocated 300mb?
And how do I go about figuring out what I should be using?