[Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Andrea Rossato
Hello, I have this very simple program that executes an external program, reads its output and prints it (the program is date). The readings is done with pipes. The problem is that memory usage constantly increases over time. Profiling does not show garbage collection of any sort. File

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Dougal Stanton
On 21/06/07, Andrea Rossato [EMAIL PROTECTED] wrote: runComLoop :: String - IO () runComLoop command = do (r,w) - createPipe wh - fdToHandle w hSetBuffering wh LineBuffering p - runProcess command [] Nothing Nothing Nothing (Just wh) (Just wh) rh - fdToHandle r

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Brandon S. Allbery KF8NH
On Jun 21, 2007, at 6:40 , Andrea Rossato wrote: I have this very simple program that executes an external program, reads its output and prints it (the program is date). The readings is done with pipes. The problem is that memory usage constantly increases over time. Profiling does not show

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Andrea Rossato
On Thu, Jun 21, 2007 at 08:18:23AM -0400, Brandon S. Allbery KF8NH wrote: On Jun 21, 2007, at 6:40 , Andrea Rossato wrote: I have this very simple program that executes an external program, reads its output and prints it (the program is date). The readings is done with pipes. The

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Bryan O'Sullivan
Andrea Rossato wrote: Now I'm going to profile for memory usage: I've seen that some GC happens if you are patient enough. Yes, the process will hit a steady state of a few megabytes of heap after a short time. By the way, your program leaks ProcessHandles. b

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Bryan O'Sullivan
Andrea Rossato wrote: Still I do not understand you reference to the leak problem. Could you please elaborate a bit? The runProcess function returns a ProcessHandle. If you don't call waitForProcess on that handle, you'll leak those handles. On Unix-like systems, this means you'll

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Andrea Rossato
On Thu, Jun 21, 2007 at 01:36:16PM -0700, Bryan O'Sullivan wrote: Andrea Rossato wrote: Still I do not understand you reference to the leak problem. Could you please elaborate a bit? The runProcess function returns a ProcessHandle. If you don't call waitForProcess on that handle,