Re: Memory Characteristics of Persistent Datastructures

2009-10-05 Thread Meikel Brandmeyer
Hi, Am 06.10.2009 um 00:55 schrieb Mark Tomko: To be explicit, the doall needs to be before the call to recur (that is, it affects the map). Is that right? Yes. It must look like (recur (doall (map ...))). Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: Memory Characteristics of Persistent Datastructures

2009-10-05 Thread Mark Tomko
To be explicit, the doall needs to be before the call to recur (that is, it affects the map). Is that right? On Oct 5, 1:31 am, Meikel Brandmeyer wrote: > Hi, > > On Oct 5, 9:50 am, Volkan YAZICI wrote: > > > > (defn leak [] > > >   (loop [v [0 0]] > > >     (recur (map + v [1 1] > > > >

Re: Memory Characteristics of Persistent Datastructures

2009-10-05 Thread Raoul Duke
> You're right, it was a memory leak, although it took me hours to find. > Clojure's lazy lists were responsible for the leak; I wasn't honestly > expecting this innocent looking code to be so insidious $0.02 another instance of this that makes me think laziness needs to be explicit in the sy

Re: Memory Characteristics of Persistent Datastructures

2009-10-05 Thread Meikel Brandmeyer
Hi, On Oct 5, 9:50 am, Volkan YAZICI wrote: > > (defn leak [] > >   (loop [v [0 0]] > >     (recur (map + v [1 1] > > > Adding a doall call fixed the leak. > > Could you please provide a more concrete (if possible working) example? > I'm trying to figure out the actual reason of the problem

Re: Memory Characteristics of Persistent Datastructures

2009-10-05 Thread Volkan YAZICI
On Sun, 4 Oct 2009, Elliott Slaughter writes: > You're right, it was a memory leak, although it took me hours to find. > Clojure's lazy lists were responsible for the leak; I wasn't honestly > expecting this innocent looking code to be so insidious > > (defn leak [] > (loop [v [0 0]] >

Re: Memory Characteristics of Persistent Datastructures

2009-10-04 Thread Elliott Slaughter
On Oct 4, 4:01 am, Christophe Grand wrote: > Are you sure you aren't leaking memory? (by keeping a reference to an ever > growing state -- do you use memoize?) You're right, it was a memory leak, although it took me hours to find. Clojure's lazy lists were responsible for the leak; I wasn't hone

Re: Memory Characteristics of Persistent Datastructures

2009-10-04 Thread Christophe Grand
Hi, Are you sure you aren't leaking memory? (by keeping a reference to an ever growing state -- do you use memoize?) Christophe On Sat, Oct 3, 2009 at 10:22 PM, Elliott Slaughter < elliottslaugh...@gmail.com> wrote: > > Thanks. > > JVisualVM shows the initial memory usage is a couple hundred MB

Re: Memory Characteristics of Persistent Datastructures

2009-10-03 Thread Elliott Slaughter
Thanks. JVisualVM shows the initial memory usage is a couple hundred MB, then decreases to levels about what you described. I'm using a 64-bit Java with the -server option to increase the max heap size. But in my actual application, the memory performance is much worse: the heap size keeps growi

Re: Memory Characteristics of Persistent Datastructures

2009-10-03 Thread hoeck
Hi, to measure memory requirements of java programs, it is better use a tool like jvisualvm. The JVM process aquires memory as it needs according to its max heap and max permgen settings. I ran your little snippet on my machine with java -Xmx5M -jar clojure.jar, and while jvisualvm reported arou