Re: [GHC] #1791: heap overflow should generate an exception

#1791: heap overflow should generate an exception -------------------------------------+------------------------------------- Reporter: guest | Owner: Type: feature request | Status: new Priority: normal | Milestone: ⊥ Component: Runtime System | Version: 6.8 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: outofmem2 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by rwbarton: @@ -0,0 +1,10 @@ + Heap overflow should produce a `HeapOverflow` exception that can be + caught, rather than shutting down the entire RTS immediately. + + [Original ticket description follows. The submitter happened to expose + another bug, which was that heap overflow was not detected at all when a + single allocation exceeded the maximum heap size. The program below now + exits with a "Heap exhausted" message.] + + ---- + New description: Heap overflow should produce a `HeapOverflow` exception that can be caught, rather than shutting down the entire RTS immediately. [Original ticket description follows. The submitter happened to expose another bug, which was that heap overflow was not detected at all when a single allocation exceeded the maximum heap size. The program below now exits with a "Heap exhausted" message.] ---- I want to use the -M option for the goals that are stated in the manual. {{{ ./TestProgram +RTS -M5m -RTS }}} Expected output: {{{ Something like "out of heap space" }}} Actual result: {{{ Machine going into a state where it swaps memory }}} This is the code for TestProgram: {{{ import Control.Monad.ST import Data.Array.ST import Data.Array.MArray import Data.Array.Base(unsafeNewArray_) main = print (runST (do make_empty_table >> return ())) make_empty_table:: ST s (STArray s (Int, Int) (Maybe ep)) make_empty_table = unsafeNewArray_ ((1, 1), (16384, 16384)) }}} This was tested with 6.9.20071018 on an athlon-xp, and confirmed by dcoutts also on x86-64 with ghc-6.8.0.20071015. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/1791#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC