i am running a couple of small servers that are written in java. There is one that listens on a standard socket, the rest communicate with each other using ActiveMQ. i noticed something strange where if i leave the system idle for a couple of hours, the RSS memory either grows by several to tens of megs or shrinks by several to tens of megs. I used jconsole to see what was going on in the servers, but the memory usage and object creation stayed relatively flat. I tested this with both Oracle Java and OpenJDK. I tried using the recommended solution of setting the MALLOC_ARENA_MAX=4, but that did not have an effect. Is there something else going on in the JVM that i am not aware of, and is there a way to stop it?
Setup:
- CentOS 7.4.1708 (2G ram, 4 processors)
- Oracle Java 8u162
- OpenJDK 1.8.0.212
- glibc 2.17