
On Thu, Jan 08, 2004 at 09:33:29AM -0800, Hal Daume III wrote:
Hi,
I'm using POpen to shell out to a command several hundreds or thousands of times per call (none of them simultaneous, though, this is completely serial). After running my program for a while, I get:
Fail: resource exhausted Action: forkProcess Reason: Resource temporarily unavailable
which basically seems to be telling me that the program hasn't been closing the old processes, even though they're definitely not in use anymore.
Does anyone have any suggestions how to get around this?
I had a similar problem, and finally I created my own solution that doesn't leave zombies and doesn't block when the launched process writes too much to stderr. I tested it in GHC 6.0. For 6.2 you'd have to change the use of forkProcess. Usage: launch :: String -> [String] -> String -> IO (ProcessStatus, String, String) (status, out, err) <- launch prog args progInput Example: *Shell> (status, out, err) <- launch "tr" ["a-z", "A-Z"] (unlines (replicate 10000 "Haskell")) *Shell> status Exited ExitSuccess *Shell> length out 80000 *Shell> mapM_ putStrLn (take 10 (lines out)) HASKELL HASKELL HASKELL HASKELL HASKELL HASKELL HASKELL HASKELL HASKELL HASKELL Best regards, Tom -- .signature: Too many levels of symbolic links