You may also use a let form wrapped around your entire defproject if you
want to avoid the duplication of code present in your example.

Andy


On Fri, Feb 7, 2014 at 8:22 AM, Lee Spector <lspec...@hampshire.edu> wrote:

>
> On Feb 5, 2014, at 11:42 PM, Michał Marczyk wrote:
>
> > This returns
> >
> > (.getTotalPhysicalMemorySize
> > (java.lang.management.ManagementFactory/getOperatingSystemMXBean))
> >
> > You could use this in your project.clj, perhaps by including
> >
> > ~(str "-Xms" (quot (.getTotalPhysicalMemorySize ...) appropriate-number))
> >
> > in :jvm-opts.
>
>
> Very cool. I had no idea I could do computation in project.clj. The
> following seems to work to allocate 80% of the a machine's RAM to my
> process (launched with "lein trampoline with-profile production run"):
>
>   :jvm-opts [~(str "-Xmx"
>                    (long (* (.getTotalPhysicalMemorySize
>
> (java.lang.management.ManagementFactory/getOperatingSystemMXBean))
>                             0.8)))
>              ~(str "-Xms"
>                    (long (* (.getTotalPhysicalMemorySize
>
> (java.lang.management.ManagementFactory/getOperatingSystemMXBean))
>                             0.8)))
>              "-XX:+UseParallelGC"]
>
> I'll ask more about the GC part in another thread.
>
> > Also, you can absolutely use your own :jvm-opts with :replace.
>
> How do I combine them? Does the big vector above just replace the [] in
> ":jvm-opts ^:replace []"?
>
> Also, does this (the :replace part) in fact do the same thing as putting
> "with-profile production" on the command line? So if I do this I can
> simplify my command line to "lein trampoline run"?
>
> Thanks!
>
>  -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