Modern JVM's pick default heap sizes based on the physical memory in
your machine. With more than 1GB of physical memory, initial heap is
1/64 and maximum heap is 1/4 of physical memory.[1]

For OpenJDK and Oracle, this command:
    java -XX:+PrintFlagsFinal -version | grep HeapSize
will show the initial and maximum heap sizes (along with a few other
numbers).

Also, you may not want to set the initial heap size as large as the
maximum heap size. Oracle[2] says (in part):

> Setting -Xms and -Xmx to the same value increases predictability by removing 
> the most important sizing decision from the virtual machine. However, the 
> virtual machine is then unable to compensate if you make a poor choice.

- Bruce

[1]
http://stackoverflow.com/questions/2915276/what-is-the-default-maximum-heap-size-for-suns-jvm-from-java-se-6
[2]
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#generation_sizing.total_heap

On Wed, Feb 5, 2014, at 08:28 PM, Lee Spector wrote:
> 
> On Feb 5, 2014, at 6:05 PM, Alex Miller wrote:
> 
> > To override the default tiered compilation, add this to your project.clj:
> > :jvm-opts ^:replace []
> 
> I was under the impression that one can get the same effect by running
> your program with:
> 
> lein trampoline with-profile production run [etc]
> 
> True? I *think* the text here implies this too:
> https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md
> 
> FWIW my goal is to be able to run a project with one command, starting
> with a project that contains only source code (with none of my code
> pre-compiled), and have it do whatever it has to do to launch (I don't
> much care how long the launch takes) and then run as fast as possible
> (often for hours or days, CPU-bound). I launch my current runs with a
> command line like the one above, and I do also specify :jvm-opts in
> project.clj, specificially:
> 
> :jvm-opts ["-Xmx12g" "-Xms12g" "-XX:+UseParallelGC"]
> 
> Except that I have to tweak those 12s manually for different machines...
> Is there any way to specify "just use whatever's available"?
> 
> Since I'm supplying other :jvm-opts I was under the impression that I
> couldn't do the ^:replace [] thing... So is "with-profile production"
> going to have the same effect?
> 
> BTW I would also love input on the GC option. I'm also not at all sure
> that one is the best, but I generate lots of garbage across large numbers
> of cores so it seemed like a good idea. But then I read something here
> about the G1 GC... is that likely to be better? If so, does anyone know
> the string to include in :jvm-opts to use it?
> 
> Thanks (& sorry to include so many questions!),
> 
>  -Lee
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to