I'm trying to debug a problem in one of my programs in which PermGen usage grows with and during each run (cumulatively within the same REPL session) until I eventually run out & get the out of memory JVM exception. So I wrote the following utility just to help me track usage while I hack:
(defn permGen [] (let [beans (java.lang.management.ManagementFactory/ getMemoryPoolMXBeans)] (doseq [mx beans] (when (= "Perm Gen" (.getName mx)) (println (.getUsage mx)))))) I ran this several times in succession: gp=> (permGen) #<MemoryUsage init = 16777216(16384K) used = 11035288(10776K) committed = 16777216(16384K) max = 67108864(65536K)> nil gp=> (permGen) #<MemoryUsage init = 16777216(16384K) used = 11036888(10778K) committed = 16777216(16384K) max = 67108864(65536K)> nil gp=> (permGen) #<MemoryUsage init = 16777216(16384K) used = 11038488(10779K) committed = 16777216(16384K) max = 67108864(65536K)> nil gp=> (permGen) #<MemoryUsage init = 16777216(16384K) used = 11040088(10781K) committed = 16777216(16384K) max = 67108864(65536K)> The thing to notice is that the used PermGen has grown by 1-2K with each run (I ran it many more times than I pasted, and that growth rate seems pretty steady). What I don't understand is why. If I understand PermGen correctly, it holds class definitions. In Clojure classes are only generated with calls to fn (see http://groups.google.com/group/clojure/browse_thread/thread/2c66650b9057f760/11a09103da821264?lnk=gst&q=permgen#11a09103da821264), and I don't have any sort of nested function creation inside my (permGen) function. I don't have any anonymous function definitions in my function, so what is causing the used PermGen growth? thanks, Greg --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---