Created
February 15, 2014 00:32
-
-
Save w01fe/9012502 to your computer and use it in GitHub Desktop.
locals clearing bug?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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