Sunday 15 March 2015

java - JVM ignoring Xms setting -



java - JVM ignoring Xms setting -

i have next java programme don't expect need much java heap:

sleeptest.java public class sleeptest { public static void main(string[] args) { while (true) { seek { thread.sleep(100000); } grab (interruptedexception e) { } } } }

therefore seek inform jvm specifying initial heap size using xms setting. seems jvm ignores , allocates default size. why ?

to illustrate start programme 3 times:

abc@yyy:~> java sleeptest & // default - 512 mb [1] 15745 abc@yyy:~> java -xms10m sleeptest & // specifying initial size of 10 mb [2] 15756 abc@yyy:~> java -xmx10m sleeptest & // forcing max heap size of 10 mb [3] 15766

and investigates memory consumption in linux:

abc@yyy:~/ebbe> grep vmsize /proc/15745/status /proc/15756/status /proc/15766/status /proc/15745/status:vmsize: 688828 kb // default /proc/15756/status:vmsize: 688892 kb // specifying initial size of 10 mb /proc/15766/status:vmsize: 166596 kb // forcing max heap size of 10 mb

here size of process 15756 indicates allocated same default.

i'm using next jvm:

java version "1.6.0" java(tm) se runtime environment (build pxa6460sr16fp1-20140706_01(sr16 fp1)) ibm j9 vm (build 2.4, jre 1.6.0 ibm j9 2.4 linux amd64-64 jvmxa6460sr16-20140626_204542 (jit enabled, aot enabled) j9vm - 20140626_204542 jit - r9_20130920_46510ifx7 gc - ga24_java6_sr16_20140626_1848_b204542) jcl - 20140704_01

and i'm running on

suse linux enterprise server 11 (x86_64) version = 11 patchlevel = 3

the vm honor -xms hint, if set low, heap grow satisfy allocation requests.

you conclude code "doesn't need much memory" based on what's in code. not take business relationship memory consumed startup of vm/jre. beware due dependencies vm has load lot of jre classes before begins executing code.

the -xms alternative meant ensure vm allocates at least much heap, lower limit heap size. vm free allocate more. thats -xmx comes image (to define upper limit).

java linux jvm

No comments:

Post a Comment