I am running a simple "hello world" web server project with maven, jetty, scala, scalate, and scalate-ssp.
running the project with "mvn jetty:run", takes 120Mb of RSS memory (ps -o rss,etime,pid,command).
However, running the exact same project on another computer, takes 480Mb of RSS memory.
first computer, mac: uname -a
Darwin mac.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
second computer, linux: uname -a
Linux linux.local 2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST 2011 x86_64 x86_64 x86_64 GNU/Linux
what can explain this difference?
I have a memory-limited environment. how to decrease the RSS memory for the second computer?
Update from the answer of joakime:
Mac:
Java HotSpot(TM)
Java version: 1.6.0_33, vendor: Apple Inc.
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Linux:
OpenJDK
Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Runtime.getRuntime().maxMemory() for mac was 120Mb, and for linux was 3500Mb.
Now I run with:
export MAVEN_OPTS="-Xmx256m -Xms10m"; mvn jetty:run
With this, on linux Runtime.getRuntime().maxMemory() gives now 227Mb (instead of 3500Mb).
However, executing "ps -o rss,etime,pid,command" still gives 430Mb of RSS memory. I need RSS memory to be less than 250Mb.
How to achieve this?