Freewind
Freewind

Reputation: 198228

`-Xms` and `-Xmx` in java 1.6 & 1.8

In my machine, I tried two difference versions of Java with the same command, but only one of them is working.

$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)

$ java -Xms1024000m -Xmx2048000m HelloWorld
'java -Xms1024000m -Xmx2048000...' terminated by signal SIGSEGV (Address boundary error)

But with jdk 1.8:

$ java version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

$ java -Xms1024000m -Xmx2048000m HelloWorld
Hello, world!

Not sure why it's different?


PS: My machine (OSX 10.11.1 (15B42)) has 16G Ram, and here I give java a much big memory setting 1024000m(1T) to see if it can work. I'm curious why with jdk 1.8, it doesn't give any errors.

My top:

Processes: 370 total, 5 running, 15 stuck, 350 sleeping, 1781 threads
17:14:59
Load Avg: 1.62, 1.56, 1.61  CPU usage: 4.1% user, 3.54% sys, 92.43% idle   SharedLibs: 125M resident, 15M data, 7908K linkedit.
MemRegions: 220057 total, 4808M resident, 111M private, 1500M shared. PhysMem: 12G used (3045M wired), 4273M unused.
VM: 1083G vsize, 527M framework vsize, 33266913(0) swapins, 36305763(0) swapouts. Networks: packets: 256063947/286G in, 534051232/503G out.
Disks: 13058865/366G read, 15889283/505G written.

Upvotes: 1

Views: 5593

Answers (1)

Jim Garrison
Jim Garrison

Reputation: 86774

-Xms1024000m is about 1 Terabyte of memory or about 1000GB. I think you mean to use -Xms1024m -Xmx2048m

Upvotes: 1

Related Questions