I'm running Jruby on Rails on Tomcat in windows, also using sidekiq for running background jobs. When I try to import large CSV files I got the dreaded heap error.
So I tried setting JAVA_OPTS
set JAVA_OPTS = -Xmx8192m -Xms8192m -Xmn4096m
and I started to get heap errors inconsistently.
Tried _JAVA_OPTIONS
set _JAVA_OPTIONS = -Xmx8192m -Xms8192m -Xmn4096m
and it picked up the new heap values; problem solved.
After this I tried running
java -XX:+PrintFlagsFinal -version | grep HeapSize
$ java -XX:+PrintFlagsFinal -version | grep HeapSize
uintx ErgoHeapSizeLimit = 0 {product}
uintx HeapSizePerGCThread = 87241520 {product}
uintx InitialHeapSize := 805102400 {product}
uintx LargePageHeapSizeThreshold = 134217728 {product}
uintx MaxHeapSize := 4292870144 {product}
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Why is the MaxHeapSize value greater than initial when I set both as the same?