Copying the pattern of jdbc/transaction*, I tried this: (defn blah [func] (func)) (defn load-exp [file timestamp filehash matrix] (blah (fn [] (dorun (map identity matrix)))))
which also consumes the heap. Can anyone explain to me what's happening here? Something about creating a anonymous function? On Tuesday, September 10, 2013 5:24:44 PM UTC-7, Brian Craft wrote: > > It seems to be something about the jdbc/transaction macro. If I rewrite > load_exp so it does nothing but walk the seq, it still consumes the heap: > > (defn load-exp [file timestamp filehash matrix] > (jdbc/transaction > (dorun (map identity matrix)))) > > > If I remove the jdbc/transaction call, it's fine. > > (defn load-exp [file timestamp filehash matrix] > (dorun (map identity matrix))) > > > > On Tuesday, September 10, 2013 3:24:29 PM UTC-7, Brian Craft wrote: >> >> Trying jhat now, reference chain here: >> >> --> cavm.h2$load_exp$fn__165@0x2aaab4b04660 (56 bytes) (field matrix:) >> --> clojure.lang.LazySeq@0x2aaab4b05388 (48 bytes) (field s:) >> --> clojure.lang.Cons@0x2aaab4b0fe08 (48 bytes) (field _more:) >> --> clojure.lang.LazySeq@0x2aaab4b10330 (48 bytes) (field s:) >> --> clojure.lang.Cons@0x2aaab6543ec0 (48 bytes) (field _more:) >> >> This looks to me like the head is being retained as a parameter to a >> function. load_exp signature is like so: >> >> defn load-exp [file timestamp filehash matrix] >> >> But surely passing a seq to a function doesn't retain the head? >> >> Here's the body of the function: >> >> (defn load-exp [file timestamp filehash matrix] >> (kdb/transaction >> (let [cid (merge-cohort file) >> exp (merge-exp file (format-timestamp timestamp) filehash cid) >> sids (load-samples cid (:samples (meta matrix)))] >> (load-exp-samples exp sids) >> (load-exp-matrix exp matrix)))) >> >> >> load-exp-matrix calls (dorun (map)) on matrix. There's one other >> reference here, where we pull the metadata. Does any of this retain the >> head? >> >> On Tuesday, September 10, 2013 2:36:29 PM UTC-7, Brian Craft wrote: >>> >>> From jmap output it's pretty clear I'm retaining the head of a seq >>> somehow, but I have no idea how, or where. Is there any way to find the >>> reference, besides staring at code waiting for enlightenment? >>> >> -- -- 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.