I have a project where I would like to have a much larger world than
the 80x80 world in Rich's ants.clj [1] demo.  When I bring the world
up past about 600x600, I get a java.lang.OutOfMemoryError.

Is this expected?  If so, is there another reasonable way to represent
a large grid with concurrent processes roaming about?  At first, I
only need to store a floating-point value in each cell location.  But
I'm also curious to know why this is such a huge memory hog (I have a
2 GB system).  I'm also ignorant of JVM issues, so any tips there
would be helpful.

Here is the relevant code:

; larger world
(def dim 600)

(defstruct cell :food :pher)

;world is a 2d vector of refs to cells
(def world
     (apply vector
            (map (fn [_]
                   (apply vector (map (fn [_] (ref (struct cell 0
0)))
                                      (range dim))))
                 (range dim))))


Thanks!
Duane Johnson


[1] http://clojure.googlegroups.com/web/ants.clj

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

Reply via email to