Skip to content

Instantly share code, notes, and snippets.

@w01fe
Created February 15, 2014 00:32
Show Gist options
  • Save w01fe/9012502 to your computer and use it in GitHub Desktop.
Save w01fe/9012502 to your computer and use it in GitHub Desktop.
locals clearing bug?
;; support code
(defn heap-mb
"Report approx heap size in megabytes."
[]
(System/gc) (System/gc)
(quot (- (.totalMemory (Runtime/getRuntime))
(.freeMemory (Runtime/getRuntime)))
1000000))
(defn mb-seq
"Make a non-chunked seq of n mb-sized elements"
[n]
(for [i (take n (iterate inc 0))]
(byte-array 1000000)))
;; the function in question
(defn consume [xs]
(loop [ys xs]
(doseq [x ys]
(println (heap-mb)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment