Reputation: 14699
I'm using the following as a means to determine if changing the java heap size via adding:
export MAVEN_OPTS=-Xmx1024m
to my bash_profile actually does what I want it to do (I'm on mac OS 10.9.3 if that matters).
Runtime rt = Runtime.getRuntime();
long totalMem = rt.totalMemory();
long maxMem = rt.maxMemory();
long freeMem = rt.freeMemory();
double megs = 1048576.0;
System.out.println ("Total Memory: " + totalMem +
" (" + (totalMem/megs) + " MiB)");
System.out.println ("Max Memory: " + maxMem +
" (" + (maxMem/megs) + " MiB)");
System.out.println ("Free Memory: " + freeMem +
" (" + (freeMem/megs) + " MiB)");
Even after recompiling/assembling via maven, none of the above change. Is there something else that I need to do for this to take effect? NB: I sourced my bash_profile after adding the export, and when I execute:
echo $MAVEN_OPTS
it is accurate.
Upvotes: 1
Views: 390
Reputation: 240860
export MAVEN_OPTS=-Xmx1024m
is passed to maven's jvm and it doesn't apply on the application you compile/launch using maven
You still need to pass this argument explicitly to JVM of your application
Upvotes: 2