On May 14, 2009, at 7:54 PM, Stephen C. Gilardi wrote: > > On May 14, 2009, at 7:13 PM, Ian Eure wrote: > >> I'm trying to process mid/large result sets with Clojure, and not >> having any success. >> >> (ns foo >> (:require [clojure.contrib.sql :as sql])) >> >> (def *db* {:classname "com.mysql.jdbc.Driver" >> :subprotocol "mysql" >> :subname "//DSN" >> :user "read" >> :password "swordfish"}) >> >> (sql/with-connection *db* >> (sql/with-query-results rs ["SELECT * FROM Foo;"] >> (prn "Done"))) >> >> When I run this at the REPL, it dies with: >> java.lang.OutOfMemoryError: Java heap space (NO_SOURCE_FILE:0) > > I would expect the code above to use minimal memory, at most a tiny > fraction of what it would take to cache all the results. I tried a > similar experiment with Derby (based on the code in > clojure.contrib.sql.test). I used visualvm to profile the memory > usage of the read and in my experiment, the results fit the > expectation. > > I recommend you take a look at your setup using visualvm or yourkit > or the like. You'll be able to get more visibility into what kinds > of objects are taking up so much memory in your case. > I'm not having any luck at all. I tried visualvm, but it seems that it doesn't support memory profiling unless you're running JDK 6. I switched my default version (I'm on OS X here), and visualvm refuses to start:
2009-05-15 14:03:15.495 java[41205:10b] Apple AWT Startup Exception : *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil 2009-05-15 14:03:15.496 java[41205:10b] Apple AWT Restarting Native Event Thread I'm a Clojure newb, and I know even less about Java. What now, run it on Debian? - Ian --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---