I am trying to run tomcat on a low memory system (150-256Mb). Even though I start the JVM with -Xmx64m (which should be the default anyway), the process immediately takes up 200Mb+.
I wonder why the JVM needs so much memory itself, or if there is a way of tuning this? Are other JVMs better than the sun one for low memory consumption – and do they work with tomcat?
Best Answer
In addition to the heap (specified by
-Xms
and-Xmx
) you need to include the non heap areas. These includeDirectByteBuffer
s are drawn from), this is initially 64mbThere is also the working space of the JVM itself which will be a few dozen mb.
You should also be aware of the Sun JVM's auto sizing when using a server class machine. Over time the definition of server class (2Gb memory, more than one core) has suffered some depreciation and now most machines are capable of triggering the
-server
optimizations. My advice is always to specify the-Xms
and-Xmx
settings and pass-server
unless you can think of a good reason not too.