I am developing a web app that runs on a
Tomcat server but the server keeps getting killed because of memory usage, and I have no idea what is wrong.
The server itself is rather small, it only has 600 MB RAM, the heap is limited to 128 MB but checking with VisualVM while in
test suggests that it barely crosses 75 MB on the heap so the limit should not be an issue. This leaves me confused because it suggests to me that it is the VM itself that uses too much memory which I have never seen or heard of and has a hard time believing. Watching the server with "top" while running showed a physical memory usage of almost 60%, that is 360 MB RAM.
The old server shows similar signs. It has 1.5 GB RAM and while idle "top" shows a physical memory use of 91.2%. It does not get killed but has to be rebooted daily to avoid problems as ending the
java process is the only way to get it to release the unused resources.
The issue cannot be reproduced in test, but that might be because the test machine runs Tomcat on a different platform (Windows, while both servers run Linux) and has significantly more RAM (12 GB) so the relative usage is smaller.