user9058115
user9058115

Reputation: 171

RSS memory growing on idle Java processes

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:

Upvotes: 0

Views: 847

Answers (1)

apangin
apangin

Reputation: 98304

Is there something else going on in the JVM

Yes. Garbage collection, JIT compilation, class loading / unloading, logging, I/O etc. More details here.

RSS of a Java process can easily go up and down by hundreds of megabytes - "several megs" is not typically an issue at all. To find where the native memory is allocated from, turn on Native Memory Tracking feature and/or use async-profiler as described in this answer.

Upvotes: 1

Related Questions