
#15595: Stack overflow in withArgs leads to infinite memory-consuming loop --------------------------------------+---------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Keywords: | Operating System: Windows Architecture: x86_64 (amd64) | Type of failure: Runtime crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+---------------------------------- Given the program: {{{#!hs import System.Environment main :: IO () main = do putStrLn "Starting" withArgs (replicate 1000 "") $ return () }}} When run with: {{{ ghc --make WithArgsBug.hs -rtsopts && WithArgsBug +RTS -K1K }}} The program prints out "Starting", then loops forever, taking 1 CPU core and allocating memory (approx 1Gb per min), until the computer is unresponsive. The program does not respond to Ctrl-C and has to be killed from the task manager. The {{{-K1K}}} flag limits the stack to approx 33Kb. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15595 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler