
#5188: Runtime error when allocating lots of memory ---------------------------------+--------------------------- Reporter: knyblad | Owner: Type: bug | Status: new Priority: low | Milestone: 7.6.2 Component: GHCi | Version: 6.12.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Comment (by rwbarton): The first attached patch checks for integer overflow in the computation of `size` in `osGetMBlocks`. With the patch the example program now exits with this message: {{{ pow: out of memory (requested 4096 MBlocks) }}} The second and third patches are extra checks for overflow when converting between integer types in `my_mmap` and `osGetMBlocks`. AFAIK it *should* always be the case that `W_` >= `nat` and that `size_t` >= `W_` on platforms supported by GHC; but on any system where that is the case, the C compiler can eliminate the tests anyways, so I recommend including both tests. Oops, I see there is a missing `%` in the middle patch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/5188#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler