1

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?

2
  • I am running that application in a virtual server hosting that limits the amount of RSS memory. Aug 15, 2012 at 23:20
  • Then look at how it looks in that server. It most likely does not run OS X... Aug 16, 2012 at 7:34

1 Answer 1

2

Without more information, I'll speculate that you have different JVM implementations (1 linux, 1 OSX) and have likely not specified the upper bounds of memory for those JVMs.

Note that different JVMs will likely specify different upper memory limit defaults. Even the same JVM version by oracle will specify different maximum memory limits differently on different OS/hardware combinations.

There's a prior question about this topic that might help: What is the default maximum heap size for Sun's JVM from Java SE 6?

Also, maven versions differ on what plugin versions they will use by default as well, you could have a difference that is entirely within the scope of maven + its plugins.

1
  • correct, I was using two different JVMs. I've updated the question with your remarks. Aug 15, 2012 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.