Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Andrea Rossato
Hello! On Sun, Oct 22, 2006 at 12:27:05AM +0400, Bulat Ziganshin wrote: as Udo said, it should be better to evaluate thunks just when they are created, by using proper 'seq' calls. While I understand why you and Udo are right, still it is difficult for me to related this discussion to my code.

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Bulat Ziganshin
Hello Andrea, Sunday, October 22, 2006, 1:37:55 PM, you wrote: as Udo said, it should be better to evaluate thunks just when they are created, by using proper 'seq' calls. While I understand why you and Udo are right, still it is difficult for me to related this discussion to my code. So I

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Andrea Rossato
Hello Bullat, first of all, thanks for your lengthy and clear explanation. On Sun, Oct 22, 2006 at 04:08:49PM +0400, Bulat Ziganshin wrote: f a b = let x = a*b y = a+b in x `seq` y `seq` (x,y) this f definition will not evaluate x and y automatically. BUT its returned

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Udo Stenzel
Andrea Rossato wrote: Now, the state will not be entirely consumed/evaluated by the user, and so it will not become garbage. Am I right? No. The state cannot become garbage, because there is still a reference to it. As long as runStateT has not returned, any part of the state can still be

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Bulat Ziganshin
Hello Andrea, Sunday, October 22, 2006, 6:06:24 PM, you wrote: f a b = let x = a*b y = a+b in x `seq` y `seq` (x,y) this f definition will not evaluate x and y automatically. BUT its returned value is not (x,y). its returned value is x `seq` y `seq` (x,y) and when

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Bulat Ziganshin
Hello Udo, Sunday, October 22, 2006, 6:41:24 PM, you wrote: Now, the state will not be entirely consumed/evaluated by the user, and so it will not become garbage. Am I right? No. The state cannot become garbage, because there is still a reference to it. As long as runStateT has not

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-21 Thread Andrea Rossato
Hallo Bulat! On Fri, Oct 20, 2006 at 10:21:51PM +0400, Bulat Ziganshin wrote: first, GC don't occurs automatically when you close file. you can help GHC by using performGC from System.Mem. i does it in my own prog I did not get an appreciable improvement with performGC, as you can see from

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-21 Thread Udo Stenzel
Andrea Rossato wrote: I did not get an appreciable improvement with performGC, as you can see from here: http://gorgias.mine.nu/haskell/a.out.withPerformGC.ps But I found a solution: just write the opml state component to a file! Obviously the values in question were not garbage, rather

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-21 Thread Andrea Rossato
Hallo! Thanks a lot for stopping by. On Sat, Oct 21, 2006 at 06:41:32PM +0200, Udo Stenzel wrote: The correct solution however, is the application of 'seq' at the right places. To understand where these are, perform a simulation of Haskell's reduction strategy on paper. I will definitely

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-21 Thread Andrea Rossato
On Sat, Oct 21, 2006 at 09:09:13PM +0200, Andrea Rossato wrote: So, it's parsec, on your side...;-) I sorry, I was a bit confused when I wrote that. I confused you for another person, obviously. Sorry about that. Andrea pgpx3F8PsFdVW.pgp Description: PGP signature

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-21 Thread Bulat Ziganshin
Hello Andrea, Saturday, October 21, 2006, 3:44:31 PM, you wrote: first, GC don't occurs automatically when you close file. you can help GHC by using performGC from System.Mem. i does it in my own prog But I found a solution: just write the opml state component to a file! and just after that

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-20 Thread Andrea Rossato
On Thu, Oct 19, 2006 at 06:23:35PM +0400, Bulat Ziganshin wrote: Hello Andrea, Wednesday, October 18, 2006, 9:34:28 PM, you wrote: solution? Or just some hints on the kind of problem I'm facing: is it related to strictness/laziness, or it's just that I did not understand a single bit

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-20 Thread Bulat Ziganshin
Hello Andrea, Friday, October 20, 2006, 2:23:16 PM, you wrote: well, you gave me a wonderfully clear introduction to Haskell GC, and now I have a better understanding of the output of the various profiling I'm doing. Thank you very much! i had the same problems too :) Still, I cannot

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-19 Thread Bulat Ziganshin
Hello Andrea, Wednesday, October 18, 2006, 9:34:28 PM, you wrote: solution? Or just some hints on the kind of problem I'm facing: is it related to strictness/laziness, or it's just that I did not understand a single bit of how garbage collection works in Haskell? i think, the second.

[Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-18 Thread Andrea Rossato
Hi! I'm a newbie and, as a learning experience, I'm writing a feed reader with hscurses and hxt. For the present time the feed reader just reads a Liferea cache but, as you can imagine, I'm running into the usual newbie problems of memory consumption and garbage collection, probably (I'm not

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-18 Thread Jason Dagit
On 10/18/06, Andrea Rossato [EMAIL PROTECTED] wrote: Hi! I'm a newbie and, as a learning experience, I'm writing a feed reader with hscurses and hxt. For the present time the feed reader just reads a Liferea cache but, as you can imagine, I'm running into the usual newbie problems of memory