Hi there,

I'm studying algo-class.org, and one of it's programming assignment
gives you a file containing contents like below:
1 2
1 7
2 100
...

There is roughly over 5 million lines, and i want to first construct a
vector of vector of integers for further process:
[[1 2][1 7][2 100]...]

Below is what the code looks like:

(def int-vec (with-open [rdr (clojure.java.io/reader "<file name>")]
                           (doall (map convert (line-seq rdr)))))

and this leads to OutOfMemory Error. I tried to generate a vector with
random intergers, and that wont introduce the error. So I guess it is
the temp objects in convert(it break down a line in a list of strings,
and then do the convert to integer) that are causing the memory issue.

Can someone advice me what would be a ideal way to handle this case in
clojure?

-- 
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

Reply via email to