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
       str <- hGetLine rh
       rc <- handleToFd rh
       hClose rh
       closeFd rc
       -- get and print the status of handles
       swh <- hShow wh
       srh <- hShow rh
       putStrLn $ show swh
       putStrLn $ show srh

       putStrLn str
       threadDelay $ 100000 * 1
       runComLoop command

main = runComLoop "date"

I honestly don't know the answer to this, and no doubt someone
intelligent will swoop in momentarily - but have you tried decomposing
runComLoop into smaller chunks to see which is using the most memory?
You could also try the 'bracket' function, which I find enormously
useful for showing which handles, etc are in scope.

Cheers,

D.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to