John Fingerhut <andy.finger...@gmail.com> writes:

> Does anyone know a way from within a Java/Clojure program to determine
> which GC algorithm is currently in use? I'm curious what the default
> is when one is not specified on the command line, and accessing the
> one being used from inside  of a program would be one good way to find
> out for sure. There doesn't seem to be anything returned by
> Runtime.getRuntime().getProperties() to indicate that. 

You can get at least something via JMX:

   (require '[clojure.contrib.jmx :as jmx])

   (map #(subs (str %) 37) 
        (jmx/mbean-names "java.lang:type=GarbageCollector,*"))

Default on my PC:        ("PS MarkSweep" "PS Scavenge")
With -XX:-UseParallelGC: ("Copy" "MarkSweepCompact")
With -XX:+UseG1GC:       ("G1 Old Generation" "G1 Young Generation")

You can also see this same data by running JConsole (shipped in the
JDK's bin directory) and attaching to a running Java process. 

-- 
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

Reply via email to