heap overflow should generate an exception
|Reported by:||guest||Owned by:|
|Type of failure:||None/Unknown||Test Case:||outofmem2|
|Related Tickets:||Differential Rev(s):||Phab:D2790|
Description (last modified by )
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
Something like "out of heap space"
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-18.104.22.16871015.
Change History (18)
comment:1 Changed 9 years ago by
|Component:||Compiler → Runtime System|
|Milestone:||→ 6.8 branch|
|Owner:||set to igloo|
|Type:||bug → merge|
comment:5 follow-up: 7 Changed 9 years ago by
|Status:||reopened → new|
|Summary:||-M option does not work → heap overflow should generate an exception|
|Type:||bug → feature request|