I always work in a single process, REPL and server, there's no need to separate them out generally.
You might have better luck with the G1 collector, in addition to JVM tuning. The G1 has the useful property of giving memory back to the OS when a GC is performed. Use the command-line flag: -XX:+UseG1GC If this is confusing, in short, PHP is 'interpreted', thus it's leaner and slower than a 'compiled' language like clojure. There's a lot of stuff that needs to be loaded for clojure to work (the compiler lives in memory), and you'll take a hit in startup-time and memory footprint. Some of this is java-specific, probably CLJS on V8 can do better in terms of memory footprint. On Mon, Mar 28, 2016 at 10:36 AM Michael Willis <willismich...@gmail.com> wrote: > You can tune memory usage by passing parameters to the JVM: > > http://docs.oracle.com/cd/E19900-01/819-4742/abeik/index.html > > The sample leiningen project file has an example of how to pass parameters > to the JVM: > > > https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L264 > > Hope that helps, > Michael Willis > > > > On Monday, March 28, 2016 at 7:11:49 AM UTC-5, Jason Basanese wrote: >> >> Hello all! I'm new to this forum. My name Is Jason Basanese and I am a >> relatively new clojurist. >> >> I recently began hosting my first small full stack Clojure web app. While >> doing this I ran into memory problems with my admittedly small load server. >> The maximum it can take in temp memory is 741MB. Too much of that memory is >> consumed giving an error when I try to run two REPLs on the server. One for >> testing and editing code and the other for leaving the app running. My >> other dynamic content websites which use php directly with Apache use >> minimal memory. Why is it that running a Clojure app like such "lein run -m >> clojureweb.core/serve" takes up so much memory? Here is the code of the >> function I am running with that command. >> >> (defn serve [& args] >> (org.apache.log4j.BasicConfigurator/configure) >> (run-server >> (logger/wrap-with-logger >> (reload/wrap-reload app)) >> {:port 8080})) >> >> Are the logger or the wrap-reload making it take up so much memory? Is >> there a better way to run Clojure apps that is less robust? Or is using a >> relatively large amount of memory just a bullet to bite when using Clojure? >> Yes I know an obvious solution would just be to upgrade the server, but >> where's the fun in that? >> >> Requests for more detail, comments, answers and opinions all welcome! >> >> -- > 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/d/optout. > -- 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/d/optout.