Skip to content
  • Ben Gamari's avatar
    rts/posix: Use less aggressive backoff schedule for heap reservation sizing · 730781b4
    Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
    When we allocate the heap on POSIX platforms we generally just ask for a
    1TB chunk of address space and call it a day. However, if the user has
    set a ulimit then this request will fail. In this case we would
    previously try successively smaller allocation requests, reducing the
    request size by a factor of two each time.
    
    However, this means that GHC will significantly allocate a significantly
    smaller heap than the available physical memory size in some
    circumstances.  Imagine, for instance, a machine with 512 GB of physical
    memory but a ulimit of 511 GB: we would be limited to a 256 GB heap.
    
    We now use a less aggressive back-off policy, reducing by one-eighth the
    last allocation size each try.
    
    Thanks to luispedro for the suggested approach.
    
    Test Plan: Validate
    
    Reviewers: simonmar, erikd
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #14492
    
    Differential Revision: https://phabricator.haskell.org/D4215
    730781b4