RE: Complexity bug in garbage collector?

On 16 April 2005 23:19, Josef Svenningsson wrote:
OK, I've cooked up this little program to study the behaviour a little closer: \begin{code} module Main where
main = print $ strictId [1..]
strictId list = let (c,c') = work list c' in c where work [] y' = (y',[]) work (x:xs) y' = (v,x:v') where (v,v') = work xs y' \end{code}
This program just allocates like crazy til it dies. The funny looking strictId function is just the strict identity function on lists. (Yes, there are simpler ways to achieve the same thing. I just think the above function is particularly sweet :-)
I do the following: $ ghc -prof -auto-all --make Main.hs $ main.exe +RTS -hd -M<VERY MUCH>
The resulting graph is suspiciously similar in shape to the one of my previous program. The garbage collector is still my primary suspect, I simply don't know how to explain the graph otherwise.
I don't see a curve in the profile on my machine: http://www.haskell.org/~simonmar/main.exe.ps This was on a Windows box, I also get the same results on a Linux machine. I was only able to test with -M600m on the Windows box. Do you need more to get the curve? Cheers, Simon

Hi,
Sorry for my late reply.
On 7/22/05, Simon Marlow
On 16 April 2005 23:19, Josef Svenningsson wrote:
OK, I've cooked up this little program to study the behaviour a little closer: \begin{code} module Main where
main = print $ strictId [1..]
strictId list = let (c,c') = work list c' in c where work [] y' = (y',[]) work (x:xs) y' = (v,x:v') where (v,v') = work xs y' \end{code}
This program just allocates like crazy til it dies. The funny looking strictId function is just the strict identity function on lists. (Yes, there are simpler ways to achieve the same thing. I just think the above function is particularly sweet :-)
I do the following: $ ghc -prof -auto-all --make Main.hs $ main.exe +RTS -hd -M<VERY MUCH>
The resulting graph is suspiciously similar in shape to the one of my previous program. The garbage collector is still my primary suspect, I simply don't know how to explain the graph otherwise.
I don't see a curve in the profile on my machine:
http://www.haskell.org/~simonmar/main.exe.ps
This was on a Windows box, I also get the same results on a Linux machine. I was only able to test with -M600m on the Windows box. Do you need more to get the curve?
I used -M512M so that should be fine. But I think you should wait a little longer before you hit ^C. When I tried it just now I waited for a minute. It produced a curve like I reported before. But maybe this has something to do with swapping? My machine was definitely swapping when I aborted the program. Can that have any effect on the timings? Cheers, /Josef
participants (2)
-
Josef Svenningsson
-
Simon Marlow