[GHC] #8189: Default to infinite stack size?

GHC ghc-devs at haskell.org
Sat Aug 31 08:11:51 UTC 2013


#8189: Default to infinite stack size?
-------------------------------+-------------------------------------------
        Reporter:  nh2         |            Owner:
            Type:  bug         |           Status:  new
        Priority:  normal      |        Milestone:
       Component:  Runtime     |          Version:  7.6.3
  System                       |         Keywords:
      Resolution:              |     Architecture:  Unknown/Multiple
Operating System:              |       Difficulty:  Easy (less than 1 hour)
  Unknown/Multiple             |       Blocked By:
 Type of failure:  Runtime     |  Related Tickets:
  crash                        |
       Test Case:              |
        Blocking:              |
-------------------------------+-------------------------------------------
Changes (by ezyang):

 * difficulty:  Unknown => Easy (less than 1 hour)
 * component:  Compiler => Runtime System


Comment:

 Yes, you will still eventually run out of memory and get a heap overflow
 error. See [[GhcFile(rts/Schedule.c)]] for how we deal with this case; we
 actually service stack overflow errors during the normal operation of
 programs, because we use stack chunks and we need to allocate a new stack
 chunk when we run out. So actually, it's pretty simple to make sure we
 give the right error when we run out of heap, change this line in
 [[GhcFile(rts/Threads.c)]]:

 {{{
 new_stack = (StgStack*) allocate(cap, chunk_size);
 }}}

 (as well as allocate) so that if requested heap allocation fails, it
 reports a stack overflow, not heap overflow. This should be pretty easy to
 do, patches welcome!

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8189#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list