Re: Why is there a space leak here?

2001-06-11 Thread Carl R. Witty
"S. Alexander Jacobson" <[EMAIL PROTECTED]> writes: > On 6 Jun 2001, Carl R. Witty wrote: > > > "S. Alexander Jacobson" <[EMAIL PROTECTED]> writes: > > > > > For example w/ foldl: > > > > > > foldl + 0 [1..1] > > > foldl (+) ((+) 0 1) [2..1] > > > foldl (+) ((+) ((+) 0 1) 2) [3..1] >

Re: Why is there a space leak here?

2001-06-09 Thread Juan Carlos Arevalo Baeza
At 10:41 AM 6/8/2001 -0400, S. Alexander Jacobson wrote: > > One portable way to implement a memoizing function in Haskell (if the > > domain of the function is countable) is to lazily build a data > > structure that contains the results of the function on every possible > > argument. Then you e

Re: Why is there a space leak here?

2001-06-08 Thread S. Alexander Jacobson
On 6 Jun 2001, Carl R. Witty wrote: > "S. Alexander Jacobson" <[EMAIL PROTECTED]> writes: > > > For example w/ foldl: > > > > foldl + 0 [1..1] > > foldl (+) ((+) 0 1) [2..1] > > foldl (+) ((+) ((+) 0 1) 2) [3..1] > > > > Can't the implementation notice that each iteration leads to a >

Re: Why is there a space leak here? (fwd)

2001-06-07 Thread Malcolm Wallace
Hi Claus, I've had a look at this example in GHood, and you are right, nhc98 does seem to create several copies of v-in. > import Observe > > foo1 m >= take m (observe "v-out" v) > where >v = 1 : concat (map triple (observe "v-in" v)) >triple x = [x,x,x] > > main = pri

Re: Why is there a space leak here?

2001-06-06 Thread Carl R. Witty
"S. Alexander Jacobson" <[EMAIL PROTECTED]> writes: > For example w/ foldl: > > foldl + 0 [1..1] > foldl (+) ((+) 0 1) [2..1] > foldl (+) ((+) ((+) 0 1) 2) [3..1] > > Can't the implementation notice that each iteration leads to a > larger closure and, if it is running out of space g

Re: Why is there a space leak here?

2001-06-06 Thread Jörgen Gustavsson
Tom Moertel wrote: > Okay, then, what is the *right* way to reason about these things? I will take the oppurtunity to advertise some recent work I have been doing together with David Sands. I think that the call-by-need lambda calculus is a very good starting point for gaining intuition about

Re: Why is there a space leak here?

2001-06-06 Thread Claus Reinke
From: "Tom Moertel" <[EMAIL PROTECTED]> > Okay, then, what is the *right* way to reason about these things? (Non?-)strictly speaking, there is no *right* way to reason about these things, as Haskell somehow seems to have neglected to acquire a semantics (blush - even Java has one, kind of..). The

Re: Why is there a space leak here?

2001-06-05 Thread Mark Tullsen
Tom Moertel wrote: > > Mark Tullsen wrote: > > > > You have to realize that Alastair Reid is one of the truly > > great Haskell programmers on planet earth. I'm serious. > > So, when he says "incredibly subtle space leak" I wouldn't > > expect the solution to be simple. > > Whoops. Now don't I

Re: Why is there a space leak here?

2001-06-05 Thread Claus Reinke
> Alastair David Reid wrote: > > Executive summary: David's program has an incredibly subtle space leak > > in it (or I'm being incredibly dumb). I encourage the honchos (and > > would be honchos) to have a look. Users of other compilers might give > > it a shot too. I think there have been sev

Re: Why is there a space leak here?

2001-06-05 Thread Mark Tullsen
"Steinitz, Dominic J" wrote: > I'd love it if someone could write a tutorial paper on space > leaks. I agree that would be very useful. > Even with the explanations that have been provided, I find it > difficult to understand why expressions get evaluated in a > particular order and why garbage

Re: Why is there a space leak here?

2001-06-05 Thread Tom Moertel
Mark Tullsen wrote: > > You have to realize that Alastair Reid is one of the truly > great Haskell programmers on planet earth. I'm serious. > So, when he says "incredibly subtle space leak" I wouldn't > expect the solution to be simple. Whoops. Now don't I feel foolish. > As far as I can t

Re: Why is there a space leak here?

2001-06-05 Thread Alastair David Reid
Mark Tullsen <[EMAIL PROTECTED]> writes: > You have to realize that Alastair Reid is one of the truly great > Haskell programmers on planet earth. I'm serious. So, when he says > "incredibly subtle space leak" I wouldn't expect the solution to be > simple. As far as I can tell, your argument

Re: Why is there a space leak here?

2001-06-05 Thread Steinitz, Dominic J
I'd love it if someone could write a tutorial paper on space leaks. Even with the explanations that have been provided, I find it difficult to understand why expressions get evaluated in a particular order and why garbage collections happen at a given point. Dominic. -

Re: Why is there a space leak here?

2001-06-05 Thread Wojciech Moczydlowski, Jr
On Tue, 5 Jun 2001, Tom Moertel wrote: > "Wojciech Moczydlowski, Jr" wrote: > > > Even so, your results suggest that nhc98 is doing something > interesting. Does the memory usage remain constant even if you take 10 > or 100 times the number of elements? If so, perhaps nhc98 is smart I was ju

Re: Why is there a space leak here?

2001-06-05 Thread Mark Tullsen
Tom, I noticed this post after I had just posted my own response. You have to realize that Alastair Reid is one of the truly great Haskell programmers on planet earth. I'm serious. So, when he says "incredibly subtle space leak" I wouldn't expect the solution to be simple. As far as I can t

Re: Why is there a space leak here?

2001-06-05 Thread Tom Moertel
"Wojciech Moczydlowski, Jr" wrote: > > How come then that the very program compiled under nhc98 evaluates without > any problem, with memory usage below 1M during its execution? My claim was that v (as defined) grew faster than it could be consumed, not that (length (foo1 n)) couldn't be evaluat

Re: Why is there a space leak here?

2001-06-05 Thread Mark Tullsen
Alastair David Reid wrote: > > Executive summary: David's program has an incredibly subtle space leak > in it (or I'm being incredibly dumb). I encourage the honchos (and > would be honchos) to have a look. Users of other compilers might give > it a shot too. > > David Bakin <[EMAIL PROTECTED]

Re: Why is there a space leak here?

2001-06-05 Thread Wojciech Moczydlowski, Jr
On Tue, 5 Jun 2001, Tom Moertel wrote: > The reason that foo1 "leaks" space is because the middle of v grows > faster than its head. So taking elements from v causes its in-memory > footprint to grow. To see why this is the case, evaluate foo1 by hand: > > So the problem isn't Hugs but rather

Re: Why is there a space leak here?

2001-06-05 Thread S. Alexander Jacobson
This whole discussion seems strange... Is laziness an operational or a semantic issue? Why can't haskell implementations reduce some expressions to save space? In particular, why can't haskell mark expressions that grow after evaluation, and reduce them if too much space is being consumed. For ex

Re: Why is there a space leak here?

2001-06-05 Thread Tom Moertel
Alastair David Reid wrote: > > Executive summary: David's program has an incredibly subtle space leak > in it (or I'm being incredibly dumb). I encourage the honchos (and > would be honchos) to have a look. Users of other compilers might give > it a shot too. > David Bakin wrote: > > Why is t

Re: Why is there a space leak here?

2001-06-05 Thread Alastair David Reid
Executive summary: David's program has an incredibly subtle space leak in it (or I'm being incredibly dumb). I encourage the honchos (and would be honchos) to have a look. Users of other compilers might give it a shot too. David Bakin <[EMAIL PROTECTED]> writes: > Why is there a space leak i

Why is there a space leak here?

2001-05-28 Thread David Bakin
Why is there a space leak in foo1 but not in foo2?  (I.e., in Hugs Nov '99) foo1 eats cells (and eventually runs out) where foo2 doesn't.   That is, if I do (length (foo1 100)) I eventually run out of cells but (length (foo2 100)) runs fine (every GC returns basically the same amount

Re: Test case Re: Is there a space leak here?

2000-02-28 Thread Joe English
I wrote: [...] > I just tried the developer snapshot of STG Hugs, and [...] > After fixing the *other* space leak that Malcolm Wallace noted, > all the tests ran without a problem. [...] > Problem solved! Thanks! Forgot to mention: my "real" program -- the XML parser -- also runs without a spa

Re: Test case Re: Is there a space leak here?

2000-02-28 Thread Joe English
Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > Consider the Data a branch. It'll be compiled to > let t = build es > siblings = fst t > rest = snd t > in ... > In many implementations, until you evaluate 'rest', you'll > keep the whole of 't'; which in turn c

re: Is there a space leak here?

2000-02-28 Thread Colin . Runciman
Joe, Have you tried any of the more powerful forms of heap-profiling, beyond static tagging of producer/construction? | My hypothesis is that 'deserialize' (the problematic function, | called 'buildTree' in my earlier message) is building up | a long chain of suspensions of the form | | s

RE: Test case Re: Is there a space leak here?

2000-02-28 Thread Simon Peyton-Jones
Joe I've not really looked at your code in detail, but this does occur to me: | -- deserialize builds a tree from a list of events; | -- (deserialize . serialize) = id | -- | -- This is the problematic function. | -- | deserialize :: [Event a] -> Tree a | deserialize events = head (fst (build ev

Fwd: Re: Is there a space leak here?

2000-02-27 Thread Bill Halchin
Oops! Never mind. I found! Thnaks, Bill >From: Joe English <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: Is there a space leak here? >Date: Sat, 26 Feb 2000 16:27:47 -0800 > >"Mark P Jones" <[EMAIL PROTECTED]> wrote: > > > Joe:

Fwd: Re: Is there a space leak here?

2000-02-27 Thread Bill Halchin
Where is the XML stuff?? Bill Halchin >From: Joe English <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: Is there a space leak here? >Date: Sat, 26 Feb 2000 16:27:47 -0800 > >"Mark P Jones" <[EMAIL PROTECTED]> wrote: > > > Joe:

Test case Re: Is there a space leak here?

2000-02-26 Thread Joe English
Here's the test case... The space profile for tests 2 and 3 look interesting; there are n triangular "spikes" (where 'n' is the breadth of the tree) that drop off sharply. My hypothesis is that 'deserialize' (the problematic function, called 'buildTree' in my earlier message) is building up a l

Re: Is there a space leak here?

2000-02-26 Thread Joe English
"Mark P Jones" <[EMAIL PROTECTED]> wrote: > Joe: As you've observed, the space behavior of Haskell > programs is often very subtle, and hard to understand. > I glanced quickly over your program but didn't see any > immediate signs of problems. My first suggestion would > be that you try using t

Help! Is there a space leak here?

2000-02-23 Thread Tom Pledger
Hi. Joe English writes: > [...] ought to run in space bounded by the depth of the tree > (which for XML documents is typically not very deep). > > This turns out not to be the case; testing with Hugs > invariably fails with a "Garbage collection fails to > reclaim sufficient space" on even

RE: Help! Is there a space leak here?

2000-02-22 Thread Jan Skibinski
[Prompted by Sergey's message about the strange dates: The mess in my headers is entirely my fault. I have not had a chance to properly finish the upgrades to this machines: internationalization and the rest. Please forgive me for this mess] On Tue,

RE: Help! Is there a space leak here?

2000-02-22 Thread Mark P Jones
| Both simulations run fine for small values of | counter "n" but fail badly when "n" becomes big, | 40,000 say. I happened to have a presentation | on the subject of Hawk about two months ago, and | the audience was not much impressed when they saw | Hugs faili

Re: Help! Is there a space leak here?

2000-02-22 Thread Jan Skibinski
On Sun, 6 Feb 2000, Joe English wrote: > This turns out not to be the case; testing with Hugs > invariably fails with a "Garbage collection fails to > reclaim sufficient space" on even moderately sized > documents (5000 nodes or so). If I remember correctly, one of the past postings

Help! Is there a space leak here?

2000-02-22 Thread Joe English
Hello, I'm trying to construct a Tree out of a list of XML parser events, with something similar to the following: data Event a = StartTag a -- start-tag, | Data a -- character data or empty tag | EndTag -- end-tag,